-
Notifications
You must be signed in to change notification settings - Fork 66
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
IPX ignores s-maxage
when max-age
is present in the HTTP source cache-control
header
#166
Comments
I have exactly the same issue ? did you get it working without a lot of hack in source code directly ? if not I'll try to make a RP |
@atinux and others maintainers does that is a big breaking change in your opinion ? |
Hi, dear @flapili, and thanks for explaining your issue. It is not a breaking change but it is not something I think we could have enabled by default. For a quick solution, i have added a new option for We could also support an option like |
Environment
Reproduction
I can pinpoint the location with the bug so it should be enough, please let me know if you need more.
Describe the bug
This code in the http source only accounts for the 1st
max-age
occurence.ipx/src/sources/http.ts
Lines 58 to 65 in b82adb7
Thing is, it seems CloudFront will include both a
max-age
ands-maxage
in the response from a cached object. An excerpt from my object response headers:The regex in the source code ignores the
s-maxage
, as can be noticed in this playground.MDN notes that:
All in all, I think IPX should do either one of two things:
maxAge
was set by the user of the module, ors-maxage
Currently, I am unable to cache
/_ipx/*
images in Nuxt 3 because all images are sent back using themax-age=0
that is inherited from the HTTP source and completely ignores what I had set (I spent way too much time debugging this).Additional context
I might be able to submit a PR for this fix, but let me know what you think would be the best approach (honestly I think a combination of both but prioritize the
maxAge
set by the developer in the IPX options).Logs
No response
The text was updated successfully, but these errors were encountered: