# Share a Streamlit app privately

> Share a Streamlit app privately with qURL by LayerV: bind it to 127.0.0.1, keep CORS and XSRF on, and trust the recipient’s exact origin.

Source: https://layerv.ai/guides/share-streamlit-app-privately/

---

[← All guides](https://layerv.ai/guides/) 

# Share a Streamlit app privately

## Why qURL here

Show someone the Streamlit app running on your machine without deploying a copy. Keep its origin and XSRF checks enabled, and allow only the exact origin of the recipient’s open qURL™ link.

Copies a prompt for any agent that runs commands. 

## What you need

- A Streamlit app you start with streamlit run; this guide was checked against Streamlit 1.66.1, and server.corsAllowedOrigins needs 1.46.0 or later
- The qURL CLI 3.4.1 or later

Content updated November 4, 2026.

## Steps

To share a Streamlit app privately with qURL by LayerV, bind it to 127.0.0.1, publish port 8501 with `qurl publish`, and send a link from `qurl share`. Once the recipient opens it, add their exact https origin to server.corsAllowedOrigins and restart, keeping CORS and XSRF protection on. Your app keeps running on your own machine, and qURL carries the live session to the recipient.

1. ### Install the qURL CLI  
Install the qURL CLI. On macOS, install it with Homebrew. On Linux and Windows, download the package for your platform from the latest release; the CLI page lists each one. Nothing asks you to sign up.  
```  
brew install layervai/tap/qurl
qurl --version
```
2. ### Bind Streamlit to localhost  
With Streamlit’s server.address unset, streamlit run listens on every interface and prints a Network URL that anyone on your network can open. Set it to 127.0.0.1 in .streamlit/config.toml next to your app. Leave enableCORS and enableXsrfProtection at their defaults, true.  
```  
# .streamlit/config.toml
[server]
address = "127.0.0.1"
port = 8501
```
3. ### Start the app  
Run Streamlit as usual from the folder that holds .streamlit/config.toml, and keep it running.  
```  
streamlit run app.py
```
4. ### Publish the app from a second terminal  
Publish Streamlit through qURL. The first publish creates this device’s identity, starts a background service that keeps serving after you close the terminal (while you stay logged in), and prints the app’s CRID, its stable ID. The Access row says who can open the app: a plain publish makes it private from qurl 3.4.1 on. `qurl share` turns the CRID into an access link, and the link is what you send.  
```  
qurl publish http://127.0.0.1:8501
```
5. ### Create a link  
`qurl share` prints an access link (https://qurl.link/#…). On a terminal, the lines below it say who published the resource and when the link expires, for example “Expires in 1d (single use)”. A publisher LayerV has verified is shown as verified by LayerV; any other name is marked UNVERIFIED. With no flags the link can be opened once and expires within 24 hours. If the expiry line does not say “single use”, don’t send the link. Add --ttl 1h for a shorter window.  
```  
qurl share <CRID>
```
6. ### Send the link to one person  
Send the qURL link directly to the recipient. Send it in a direct message, not a public channel: whoever opens it first uses it. Avoid email and apps that preview links, because a scanner that runs the page could use its one opening. Don’t open it yourself to check it, for the same reason. Run `qurl share` again whenever you need a fresh link.
7. ### Trust the recipient’s exact origin  
Streamlit accepts its WebSocket only from the page’s own host, local addresses, and the origins you list. Through qURL the browser is on r\_….qurl.site while Streamlit receives c-….qurl.site, so until you list the origin the recipient sees the app’s loading skeleton and nothing else. Ask the recipient to send you the exact https origin from the address bar of the page they just opened (scheme and hostname, without a path). They must keep that page open; do not open their single-use link yourself. Add it to server.corsAllowedOrigins, restart streamlit run, and ask them to reload the same page. Do not list https://\*.qurl.site: it includes apps run by other publishers.  
```  
# .streamlit/config.toml
[server]
address = "127.0.0.1"
port = 8501
corsAllowedOrigins = ["https://r_your-link.qurl.site"]
```
8. ### End the review and restore local settings  
Stop sharing, remove the recipient origins you added to corsAllowedOrigins, then restart Streamlit. Keep its CORS and XSRF protection enabled.  
```  
qurl stop <CRID>
```

## What the recipient sees

After the reload, the app runs at an address like https://r\_….qurl.site/.

Widgets rerun the script as they do locally, over Streamlit’s WebSocket, which a qURL link carries. File uploads work with XSRF protection on: its cookie belongs to the host the browser is on.

## Troubleshooting

__Troubleshooting__
| If you see                                                              | Do this                                                                                                                                                                                                                                                                                                                  |
| ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| The recipient sees the app’s loading skeleton and nothing else          | If the terminal logs “Rejecting WebSocket connection with disallowed Origin or Host header”, their origin is not in server.corsAllowedOrigins. Add the exact https://r\_….qurl.site origin from their address bar, restart streamlit run, and have them reload. A new link can land on a new hostname; add that one too. |
| A forum answer says to set enableCORS and enableXsrfProtection to false | Don’t. With enableCORS false, Streamlit accepts a WebSocket from any origin and sends Access-Control-Allow-Origin: \* on most routes. enableXsrfProtection only guards file uploads, and it works through qURL. One corsAllowedOrigins entry is enough.                                                                  |

__More troubleshooting__
| If you see                                                                                                             | Do this                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| You set server.allowedHosts and the WebSocket is still rejected                                                        | server.allowedHosts (Streamlit 1.61 and later) checks the Host header, which through qURL is c-….qurl.site. Add that host, and keep localhost and 127.0.0.1 so the app still opens on your machine; or leave the list empty, which accepts any Host.                                                                                                                                                                                  |
| qurl publish says the local app is not accepting TCP connections                                                       | Start the app first and check that curl works on the same address. qurl publish connects to localhost as 127.0.0.1, so if your app listens only on IPv6 (on macOS or Linux, lsof -iTCP -sTCP:LISTEN -nP shows \[::1\]), publish 'http://\[::1\]:PORT' instead, or start the dev server with --host 127.0.0.1 and publish that address. Neither requires listening on your LAN. Keep the quotes: zsh treats the brackets as a pattern. |
| The recipient sees “Access link invalid”                                                                               | The link was already used or has expired. Run qurl share again and send the new link.                                                                                                                                                                                                                                                                                                                                                 |
| The recipient sees “Resource not found”                                                                                | The resource was deleted after the link was made. Publish the app again, then run qurl share and send the new link.                                                                                                                                                                                                                                                                                                                   |
| publish rejects http://127.0.0.1 with “only HTTPS URLs are allowed”, asks you to log in, or prints no Access: line     | Your qURL CLI is out of date. On macOS run brew update, then brew upgrade qurl; elsewhere install the latest release. After updating, qurl --version prints 3.4.1 or later, and every publish is private by default.                                                                                                                                                                                                                  |
| publish says this Linux session “can’t reach a systemd user manager”                                                   | You are in a container or sandbox without a user service manager. Run qurl publish with --foreground; sharing lasts as long as that process runs. [Container and CI setup →](https://layerv.ai/guides/share-from-a-container-or-ci/)                                                                                                                                                                                                  |
| publish says “Quota Exceeded” with “protected resource limit reached”, or “Your qURL account has reached a plan limit” | You can see this without an account: a device with no account can keep up to 3 active resources, with links that last up to 24 hours. Run qurl list --status active, then qurl delete <CRID> for any you no longer need (it asks you to confirm; --yes skips that). qurl stop keeps the resource, so it does not free a slot.                                                                                                         |

## Frequently Asked Questions

Why does Streamlit show “Please wait…” or “Connection error” through a tunnel? 

Streamlit needs its WebSocket to open before the app becomes interactive. Through qURL, add the recipient’s exact https origin to server.corsAllowedOrigins and restart Streamlit. Keep CORS and XSRF protection enabled, then have the recipient reload the same page.

Which Streamlit settings matter behind a private link? 

For Streamlit, set server.address to 127.0.0.1, list the recipient’s exact origin in server.corsAllowedOrigins, and keep server.enableCORS and server.enableXsrfProtection enabled. If you configured server.allowedHosts, also allow the c-….qurl.site Host that the app receives.

Why does Streamlit reject the WebSocket through qURL and not through ngrok? 

Streamlit accepts a WebSocket whose Origin matches the Host it receives. Through ngrok both name the same hostname. Through qURL the browser is on r\_….qurl.site and Streamlit receives c-….qurl.site, so the origin has to be listed in server.corsAllowedOrigins.

Does Streamlit listen on my network by default? 

Yes. With Streamlit’s server.address unset it binds every interface and prints a Network URL with your machine’s LAN address. Setting server.address to 127.0.0.1 keeps it on this computer; qURL connects to it there.

Do I need to turn off XSRF protection? 

No. Streamlit’s config docs now say it does not enable server.enableCORS for you when server.enableXsrfProtection is true, and that a WebSocket does not need a valid XSRF token, so XSRF protection does not replace CORS.

Who else can reach my app while the link is open? 

Opening a qURL link starts a session for that browser, which lasts 1 hour by default. After a browser opens it, another browser on the same public IP cannot use its access. A script or agent that opens the link without a browser is admitted by its network address instead, which other devices on that public IP share until the session ends. A link admits whoever opens it: the API’s IP and country rules do not apply to the signed links qurl share issues. Keep your app’s own sign-in for anything sensitive.

Does my computer have to stay on? 

Yes. Your Streamlit app runs on your machine. The machine and app must stay running and connected; the app is unavailable while the machine is asleep.

How do I stop sharing? 

Run qurl stop <CRID> to pause serving the app, and qurl start <CRID> to resume it; a stopped app still counts toward your resource limit. qurl delete <CRID> removes the resource for good after asking you to confirm; its CRID can never be shared again.

## Related Resources

[Guide: Gradio share=True alternative: private app sharing →](https://layerv.ai/guides/share-gradio-app-privately/) [Guide: Share a Jupyter notebook remotely →](https://layerv.ai/guides/share-jupyter-notebook-privately/) [Guide: Access ComfyUI remotely with a private link →](https://layerv.ai/guides/share-comfyui-privately/) [Guide: Share an MLflow or TensorBoard dashboard →](https://layerv.ai/guides/share-mlflow-or-tensorboard-dashboard/) [Guide: Share a dev server with a client →](https://layerv.ai/guides/share-dev-server-with-client/) [Streamlit docs: config.toml ↗](https://docs.streamlit.io/develop/api-reference/configuration/config.toml) [Streamlit docs: share a Community Cloud app ↗](https://docs.streamlit.io/deploy/streamlit-community-cloud/share-your-app)

## Publish your app now

Install the CLI, then run one command. No sign-up, no API key.

[Install the CLI →](https://layerv.ai/cli/)



---

*This markdown version is auto-generated from [https://layerv.ai/guides/share-streamlit-app-privately/](https://layerv.ai/guides/share-streamlit-app-privately/) for AI agents. Curated agent resources: [llms.txt](https://layerv.ai/llms.txt). For the full interactive experience, visit the HTML version.*

