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

Add Cache-Control support for Parse.Files / FilesRouter #1857

Closed
andresgarza opened this issue May 20, 2016 · 12 comments
Closed

Add Cache-Control support for Parse.Files / FilesRouter #1857

andresgarza opened this issue May 20, 2016 · 12 comments
Labels
type:feature New feature or improvement of existing feature

Comments

@andresgarza
Copy link

Currently, the FilesRouter sets no response headers other that the Content-Type of the file being requested. It would be great if we could somehow configure also sending a Cache-Control header for file requests.

One idea would be for each Parse.File to specify its cache mechanism (by default it could have caching disabled). Another idea is to have a "global" caching mechanism that could work as a default.

I would gladly help submitting a PR if someone could point me in the right direction :)

@drew-gross
Copy link
Contributor

This is a great idea. @skinp has done most of our files related code, hopefully he can point out where this might be added.

@KBog
Copy link

KBog commented Jul 19, 2016

Any update on this?

I implemented CloudFront support using my AWS S3 storage. But running the PageSpeed Insights from Google suggests that my files don't have Cache-Control: (expiration not specified).

Thanks!

@flovilmart
Copy link
Contributor

Not yet, but your could take over @KBog . Also you coud implement it into the https://github.com/parse-server-modules/parse-server-s3-adapter as a global cache control for all s3 uploaded files

@KBog
Copy link

KBog commented Jul 19, 2016

Here's my attempt to add the global cache control as you suggested:
parse-community/parse-server-s3-adapter#13

I made the change locally at first (localhost), and was able to see (in Chrome debugger) the "Cache-Control" being added to newly saved Parse.Files.

Pardon any newbie mistakes, as I'm still a beginner when it comes to web/server dev :)

@flovilmart
Copy link
Contributor

let's see how it goes!

@bchapin
Copy link

bchapin commented Dec 15, 2016

Has cache control been added to the current S3 adapter?

@KBog
Copy link

KBog commented Dec 16, 2016

Yes, it's been out for a while. Tested it and working in our production app.

@KBog
Copy link

KBog commented Dec 16, 2016

Should probably close this issue to avoid confusion.

@andresgarza
Copy link
Author

I believe the cache-control only works if you are accessing the files directly through S3 (directAccess=true).

@yaaminu
Copy link

yaaminu commented Jul 31, 2017

Is the cache control available for non S3 file adapters?

@montymxb
Copy link
Contributor

Looks like this has been added to the S3 adapter but was never closed out. Taking care of it now, let us know if we're missing anything and this needs be reopened!

@thibautvdu
Copy link

Looks like this has been added to the S3 adapter but was never closed out. Taking care of it now, let us know if we're missing anything and this needs be reopened!

I just read this thread looking for an answer. If I'm right, the initial question has never been answered and this is still not an option for the standard FilesRouter. Is there any option to set the Cache-Control header with the standard GridFS adapter ?

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

9 participants