Possible to modify response headers from a proxied request before the response is written do the cache? (modified headers should be written to disk)
Manuel
manuel.baesler at gmail.com
Tue Mar 12 20:42:22 UTC 2019
Hi Maxim,
thanks for taking the time to answer my question.
> From practical point of view, however, these should be enough to
> return correct responses to clients. What is stored in the cache
> file is irrelevant.
Well, the expires header is in the cached file, and that was the problem.
The expires was not 30d but some 1.x days.
And so the cache will request upstream to early, because upstream
returned Cache-Control: max-age=126195
I want to cache the upstream resource for 30d
regardless of the returned cache headers from upstream.
My solution now is a two step approach:
step one: check cache, if the resource is expired
or not cached, nginx calls itself to get the resource.
Step two: call upstream and modify the expires
header to 30d. Return response to the cache.
Cache is now happy with an expires 30d header :-)
Kind regards,
Manuel
More information about the nginx
mailing list