Add Header to cached response?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Add Header to cached response?

Roger Fischer
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
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Add Header to cached response?

Maxim Dounin
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
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx