Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serveStaticMiddleware should not fail when allow is configured #5416

Closed
7 tasks done
benmccann opened this issue Oct 25, 2021 · 0 comments
Closed
7 tasks done

serveStaticMiddleware should not fail when allow is configured #5416

benmccann opened this issue Oct 25, 2021 · 0 comments

Comments

@benmccann
Copy link
Collaborator

benmccann commented Oct 25, 2021

Describe the bug

I would like to only allow serving of the publicDir in SvelteKit via the allow method. However, it looks like root is always served

middlewares.use(serveStaticMiddleware(root, server))

When I set server.fs.allow to only allow serving the static directory that causes all requests to fail since serveStaticMiddleware is serving the root directory and will fail the access check

Reproduction

npm init svelte@next my-app
cd my-app
npm install

Set kit.vite.server.fs.allow equal to kit.files.assets (i.e. ['static']) and then run npm run dev

System Info

Vite 2.6.11

Used Package Manager

npm

Logs

Browser gives 403 error

Validations

@benmccann benmccann changed the title serveStaticMiddleware should serve publicDir instead of root directory serveStaticMiddleware should not fail when allow is configured Oct 25, 2021
patak-dev added a commit that referenced this issue Oct 25, 2021
patak-dev added a commit that referenced this issue Oct 25, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant