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

Serve immediate 404 for static files (no fallthru) #5888

Merged
merged 1 commit into from Feb 23, 2016

Conversation

ErisDS
Copy link
Member

@ErisDS ErisDS commented Sep 27, 2015

Need to take this for a proper spin, but I'm quite excited by this improvement!

closes #5887

  • upgrade express to 4.13.*, which has serveStatic 1.10.0, and in turn has the new 'fallthrough' option
  • change local-file-store and middleware serving /public/ and /shared/ files to use the new fallthrough: false option
  • 404s are now served directly, without slashes or uncapitalise getting triggered

ErisDS added a commit to ErisDS/Ghost that referenced this pull request Oct 11, 2015
refs TryGhost#5286, TryGhost#4172, TryGhost#5888

- no need to pass blogApp around in middleware
- improve test coverage to 100%
@ErisDS ErisDS self-assigned this Jan 11, 2016
closes TryGhost#5887

- make use of the new 'fallthrough' option which landed in express-static 1.10.0
- change local-file-store and middleware serving `/public/` and `/shared/` files to use the new `fallthrough: false` option
- 404s are now served directly, without slashes or uncapitalise getting triggered
@ErisDS ErisDS changed the title [WIP] Serve immediate 404 for static files (no fallthru) Serve immediate 404 for static files (no fallthru) Feb 22, 2016
@ErisDS
Copy link
Member Author

ErisDS commented Feb 22, 2016

This is ready for primetime.

There are some additional todos:

I'll raise these as separate issues, with an idea of what to do. I had been letting those TODOs block this, which is dumb cos this is a great improvement all on its own.

@sebgie
Copy link
Contributor

sebgie commented Feb 22, 2016

This test failure seems to be genuine :-/.

@ErisDS
Copy link
Member Author

ErisDS commented Feb 22, 2016

The error I saw was the same as the one reported in #6550

Uncaught TypeError: Cannot read property \'get\' of undefined at http://localhost:7357/assets/ghost.js, line 8731\n'

It's an ongoing issue but not related to this PR

sebgie added a commit that referenced this pull request Feb 23, 2016
Serve immediate 404 for static files (no fallthru)
@sebgie sebgie merged commit 81f119d into TryGhost:master Feb 23, 2016
@sebgie sebgie deleted the improve-fileserve branch February 23, 2016 16:15
@ErisDS ErisDS removed their assignment Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serve 404s for static files more gracefully
2 participants