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

Fallback image should respect Cache-Control headers #563

Closed
nicolasbuch opened this issue Aug 2, 2024 · 2 comments · Fixed by #573
Closed

Fallback image should respect Cache-Control headers #563

nicolasbuch opened this issue Aug 2, 2024 · 2 comments · Fixed by #573

Comments

@nicolasbuch
Copy link

nicolasbuch commented Aug 2, 2024

Is your feature request related to a problem? Please describe.
We are processing PDF files, converting them to images before serving them through the SIH.

This process usually takes a few seconds and in rare cases a user can request an image that has not yet been processed and therefore does not exist. Here we return a default image through the DEFAULT_FALLBACK_IMAGE functionality which works well.

The problem is that the image is available a few seconds after the user originally requested it. If the user requests the image again, after it is available, the 404 response that he got the first time is cached. This seems to be because the cache control header is hardcoded to max-age=31536000.

Describe the feature you'd like
The DEFAULT_FALLBACK_IMAGE should respect the Cache-Control headers set on the fallback image instead of being hardcoded to max-age=31536000. I can see that this is the case when serving images that do not fallback as seen here.

I think that a similar implementation would solve the problem

@simonkrol
Copy link
Member

simonkrol commented Aug 6, 2024

Hi @nicolasbuch,

I think that's reasonable, I've added a task to evaluate adding this to a future SIH release.

Thanks for your insight,
Simon

@nicolasbuch
Copy link
Author

nicolasbuch commented Aug 20, 2024

@simonkrol I went ahead and created a tiny PR to fix this issue. Hopefully this will be helpful to resolve the issue, since this enhancement is important to us.

Thanks a lot
Nicolas

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

Successfully merging a pull request may close this issue.

2 participants