HTTP 403 response with valid route component called tests.svelte
in dev #4353
Description
Describe the bug
With a route component called tests.svelte
, I'm seeing the following warning in dev only.
When I run this in Stackblitz or similar, I don't see this issue when I hit the /tests
route directly, but in a brand-new local SvelteKit project (either the skeleton or the demo), I see it.
The other slightly strange thing is that when I click through a link to this route from an index page, the page renders as expected, no errors at all. When I reload /tests
, this error shows.
Bug could be in vite's dev server rather than Sveltekit directly, but it's certainly impacting sveltekit.
Reproduction
- Clone https://github.com/qbunt/tests-route-sveltekit
- Install deps
- Run
npm run dev -- --open
- Click the
link to tests
link - See no error and the content of the
tests
page - Refresh the page
- See 403 response regardless of a valid route
Logs
403 Restricted
The request url "/Users/qbunt/Desktop/test-svelte/tests" is outside of Vite serving allow list.
- /Users/qbunt/Desktop/test-svelte/static
- /Users/qbunt/Desktop/test-svelte/src/lib
- /Users/qbunt/Desktop/test-svelte/src/routes
- /Users/qbunt/Desktop/test-svelte/.svelte-kit
- /Users/qbunt/Desktop/test-svelte/src
- /Users/qbunt/Desktop/test-svelte/node_modules
Refer to docs https://vitejs.dev/config/#server-fs-allow for configurations and more details.
System Info
System:
OS: macOS 12.3
CPU: (10) arm64 Apple M1 Max
Memory: 6.59 GB / 64.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.0 - ~/Library/Caches/fnm_multishells/55751_1647444823499/bin/node
Yarn: 1.22.17 - /opt/homebrew/bin/yarn
npm: 8.3.1 - ~/Library/Caches/fnm_multishells/55751_1647444823499/bin/npm
Browsers:
Brave Browser: 96.1.32.115
Chrome: 99.0.4844.74
Chrome Canary: 98.0.4758.2
Edge: 99.0.1150.39
Firefox: 98.0.1
Firefox Developer Edition: 96.0
Firefox Nightly: 97.0a1
Safari: 15.4
Safari Technology Preview: 15.4
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.33
@sveltejs/kit: next => 1.0.0-next.298
svelte: ^3.46.0 => 3.46.4
Severity
annoyance
Additional Information
When working with the static adapter, after a build, the tests
route renders as expected during a refresh. If this should be re-filed with Vite, please let me know, I have actual tests
routes I'd like to support. You guys rule, thanks!