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

express.static overrides the route handler #9074

Closed
wants to merge 1 commit into from

Conversation

danieldunderfelt
Copy link

I just spend some time debugging an inexplicable error where my route handler was not being called but the site continued working. Turns out, express.static will override a / route when the index.html file is found in the static root. No server example (this included until now) of serving a CRA app has made note of this. Setting index: false on the static middleware turns off this behaviour and returns control to the route handler.

I ran into this using Express v4.17.1 and using no other Express middeware than express.static.

I just spend some time debugging an inexplicable error where my route handler was not being called but the site continued working. Turns out, express.static will override a `/` route when the `index.html` file is found in the static root. No server example (this included until now) of serving a CRA app has made note of this. Setting `index: false` on the static middleware turns off this behaviour and returns control to the route handler.
@stale
Copy link

stale bot commented Jun 28, 2020

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Jun 28, 2020
@stale
Copy link

stale bot commented Jul 3, 2020

This pull request has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants