-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Re: @remix-run/serve
sets high max-age
and immutable
cache header on everything
#9353
Comments
There was already a bug of the same nature |
So, actually the problem is that here
The config should actually be something like this
|
@remix-run/serve
sets high max-age
and immutable
cache header on everything
The main problem is that these headers are also sent on a 404 error. |
This issue seems to be fixed in the react-router codebase but not Remix |
This is a pretty serious bug. It just resulted in a cached forever file on 10,000 visitors to my website that now I have to rename in order to update, but I can not easily rename it because of the nature of it. I run https://web3dsurvey.com and I recently moved to Remix and the way you embed this tracker is now "public, max-age=31536000, immutable" on 10,000 visitors: https://web3dsurvey.com/collector-iframe.html (more secure method) I tried replacing the files in /public with custom routes that force the headers, e.g.:
Strangely it worked for collector-iframe.html, but not for collector.js. That is pretty inconvenient for me. :/ |
I've moved away from remix:server and adopted the Fastify integration and now it works properly: https://github.com/mcansh/remix-fastify /assets is immutable, cached forever because it has unique URLs. /public is no-cache, but it will serve up 304 unmodified to save bandwidth. Those are good defaults. |
Reproduction
build
thenstart
/favicon.ico
requestThe favicon from
/public
comes withCache-Control: public, max-age=31536000, immutable
System Info
Used Package Manager
npm
Expected Behavior
The server config from
https://github.com/remix-run/remix/blob/main/packages/remix-serve/cli.ts
says
app.use(express.static("public", { maxAge: "1h" }));
.So it is expected to have
maxAge=1h
Actual Behavior
We actually get an
immutable
maxAge=1y
The text was updated successfully, but these errors were encountered: