Welcome! Log In Create A New Profile

Advanced

Add Header to cached response?

Posted by Roger Fischer 
Roger Fischer
Add Header to cached response?
September 10, 2018 08:10PM
Hello,

is there a way to add a header to the cached response?

I have used ngx_http_headers_module’s add_header directive, which adds the header to the response at the time the response is generated.

What I would like to do is to add a response header at the time when the upstream request is made (reflecting the state of the caching request, not the used-the-cache request).

Thanks…

Roger

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Maxim Dounin
Re: Add Header to cached response?
September 11, 2018 03:10AM
Hello!

On Mon, Sep 10, 2018 at 11:06:00AM -0700, Roger Fischer wrote:

> is there a way to add a header to the cached response?
>
> I have used ngx_http_headers_module’s add_header directive,
> which adds the header to the response at the time the response
> is generated.
>
> What I would like to do is to add a response header at the time
> when the upstream request is made (reflecting the state of the
> caching request, not the used-the-cache request).

Cache saves the response as received from the upstream server,
without any modifications. If you want to modify it somehow
before the response is saved into the cache, you can do this
either on the upstream server itself, or by using additional
proxying.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login