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

Possibility to set Cache-Control for files served by the standard FilesRouter #6427

Open
thibautvdu opened this issue Feb 20, 2020 · 6 comments
Labels
type:feature New feature or improvement of existing feature

Comments

@thibautvdu
Copy link

Referencing the closed issue #1857 which has been closed without being apparently solved, I'm looking for a way to set the Cache-Control header for files served with the standard parse server configuration, that is files which are stored on MongoDB through gridfs.

A great solution would be to be able to specify a default value for all the answers given by the FilesRouter and to further fine tune it with key-value pairs 'file extension' - 'Cache-Control value'.

I couldn't find any mention of such an option in the documentation, apart for files delivered through the S3 adapter. This seems to be an important feature when using a CDN, am I missing something such as a possibility to do it over parse through express ?

@grosscorporation
Copy link

you won't need this if you are using NGINX or Apache, nodejs is not ideal for caching and serving files

@stale
Copy link

stale bot commented Apr 5, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 5, 2020
@stale stale bot closed this as completed Apr 12, 2020
@ghost
Copy link

ghost commented Mar 17, 2021

Any update on this?

@thibautvdu
Copy link
Author

@neiroc not that I know of at least :/

@mtrezza
Copy link
Member

mtrezza commented Mar 17, 2021

Reopening issue due to continued discussion.

Is anyone interested in tackling this in a PR?

@mtrezza mtrezza reopened this Mar 17, 2021
@ghost
Copy link

ghost commented Mar 22, 2021

Hi @mtrezza I'd like to help but I'm not too sure how... I would do as @zhxiaogg did in this PR #4348. He basically added the 'Cache-Control', 'public, max-age=86400' header to the response but i don't think it's enough. Even if the browser is caching the file, for instance an image, when requested that file is not GET from the cache but it will get it from the parse server route. Why ?

An alternative it could be to use the FSAdapter to store the files in the local storage instead of saving them in mongodb with Gridstore. All suggestion are welcome

@mtrezza mtrezza added type:feature New feature or improvement of existing feature and removed type:improvement labels Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

2 participants