Steps
SvelteKit’s Vite-based dev server blocks unknown hosts. Add the tunnel domain, such as .qurl.site, to server.allowedHosts in vite.config.js; vite preview inherits that list. Form actions work in vite dev, which skips SvelteKit’s CSRF check. With qURL, share vite dev through single-use links while the app stays on your machine with no public URL.
Read the host from the error
The page answers 403: “Blocked request. This host ("c-k3j2ab.qurl.site") is not allowed. To allow this host, add "c-k3j2ab.qurl.site" to server.allowedHosts in vite.config.js.” Allow the tool’s domain rather than that one host, so the next link works too.
Add the tool’s domain to server.allowedHosts in vite.config.js
Put server beside the sveltekit() plugin you already have. A leading dot allows the domain and every subdomain: .qurl.site for qURL, your exact dev domain for ngrok, .trycloudflare.com for a Cloudflare Quick Tunnel. Vite applies the change without a restart.
// vite.config.js (merge into your existing config) export default { plugins: [sveltekit(/* your options */)], server: { allowedHosts: ['.qurl.site'] }, }
What the recipient sees
With the domain allowed, the app loads through the link, hot reload connects, and form actions submit.
Troubleshooting
| If you see | Do this |
|---|---|
| Under vite preview or a build, form actions fail with “Cross-site POST form submissions are forbidden” | SvelteKit checks a form post’s Origin outside dev, and csrf.trustedOrigins accepts only exact origins, not a pattern such as https://*.qurl.site. Share vite dev for a review: SvelteKit skips the check there. |
| 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. |
Show 5 more fixes
| If you see | Do this |
|---|---|
| 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 → |
| 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
Does SvelteKit check CSRF in vite dev?
No. SvelteKit’s docs say its CSRF checks apply only in production, and vite dev accepts form posts from any origin. vite preview and production builds check the Origin header.
Where does the config go in SvelteKit 3?
In vite.config.js: SvelteKit 3 takes its options inside sveltekit(...) and does not start when a svelte.config.js file exists. server.allowedHosts is a Vite option, so it sits beside the plugin in SvelteKit 2 and 3.
Who else can reach my app while the link is open?
Opening the 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.