Welcome! Log In Create A New Profile

Advanced

Re: 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
March 12, 2019 04:44PM
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
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

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 March 11, 2019 08:00PM

Re: Possible to modify response headers from a proxied request before the response is written do the cache? (modified headers should be written to disk)

Maxim Dounin March 12, 2019 08:44AM

Re: 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 March 12, 2019 04:44PM

Re: Possible to modify response headers from a proxied request before the response is written do the cache? (modified headers should be written to disk)

Maxim Dounin March 12, 2019 10:12PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 106
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready