-
Notifications
You must be signed in to change notification settings - Fork 648
Add Vary header to prevent caching routes with different content types #910
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
Conversation
Here is what I see in a clean
Ideally, the other static files outside of For all the dynamic responses served by the backend the full |
To follow up on this, I think that long term we should look to move the following routes to somewhere under
That would eliminate the need for setting the header in our nginx configuration, which isn't always available (such as during development). I see no issue with merging this PR as a workaround for now. Maybe add something like The routes listed above are used only by the frontend. The |
Such as the /me route, which can be requested by the browser for its frontend HTML or its backend JSON, but the browser should not cache either and return it for the other one. Fixes rust-lang#888.
I'm going to merge this in as-is. I do want to move those /me routes in the backend eventually, but I want to fix this issue now :) bors: r+ |
910: Add Vary header to prevent caching routes with different content types r=carols10cents Such as the /me route, which can be requested by the browser for its frontend HTML or its backend JSON, but the browser should not cache either and return it for the other one. Fixes #888. I was able to reproduce the problem with reloading locally when, instead of using `ember serve`, I ran `npm run build -- --environment production` and then served the files in `dist` using nginx. This change fixed the problem! @sgrif @jtgeibel do yinz see any reason NOT to set this header for literally any non-asset route?
Build succeeded |
1017: Move backend routes under api/v1 r=carols10cents For consistency, to avoid the clash with the frontend /me route that caused problems with staying logged in, to make it clear that these routes are part of the public HTTP API provided by crates.io, and to let us evolve these routes in the future. This would make me feel comfortable about adding a cargo command that uses the info from the backend me route (see #1012). We could do this more conservatively by leaving the old routes here and only adding the new routes... but we haven't made any guarantees about the stability of these routes, so... See discussion: #910 (comment) @jtgeibel wdyt?
Such as the /me route, which can be requested by the browser for its
frontend HTML or its backend JSON, but the browser should not cache
either and return it for the other one.
Fixes #888.
I was able to reproduce the problem with reloading locally when, instead of using
ember serve
, I rannpm run build -- --environment production
and then served the files indist
using nginx. This change fixed the problem!@sgrif @jtgeibel do yinz see any reason NOT to set this header for literally any non-asset route?