-
Notifications
You must be signed in to change notification settings - Fork 189
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 appropriate cache headers to microservices, cache them in nginx #1936
Comments
#1978 adds cache headers for the status service. |
I might just make a module in Satellite that will add headers onto the passed Response object, I'll add in a test specifically for |
@Metropass there are npm modules that will do this, we could research one and use it. |
I found this, it might be useful specifically for |
I don't think that module will help us here. I'm also not 100% sure we need to do anything special in Satellite for this: we just need to specify headers on a per-route basis in each microservice. If we later find out that there are common patterns, we can extract them into something generic in Satellite; but let's not start there. |
@aserputov, what is your progress related to this? |
@JerryHue work in progress. |
@JerryHue I think we should move this one too. |
In production we have our services running behind nginx, and it's amazing at caching. If we set the appropriate cache headers (e.g.,
cache-control
,etag
, etc), nginx and the users' browsers will improve performance by caching everything.Some resources:
We can either do this manually in each service, or we could add some helper middleware in Satellite to allow each microservice to opt-in to various types of caching.
You can see how we do the caching for various things in nginx now: https://github.com/Seneca-CDOT/telescope/blob/master/config/nginx.conf.template#L173-L230.
See also https://github.com/Seneca-CDOT/telescope/blob/master/config/nginx.conf.template#L127-L133 and https://github.com/Seneca-CDOT/telescope/blob/master/config/nginx.conf.template#L233-L244 for how we do the nginx caching for the Telescope 1.0 backend. We'd need something similar for the API server definition https://github.com/Seneca-CDOT/telescope/blob/master/config/nginx.conf.template#L152-L164.
The text was updated successfully, but these errors were encountered: