How to save into variable proxy header response?

Maxim Dounin mdounin at
Mon Apr 21 10:55:46 UTC 2014


On Sun, Apr 20, 2014 at 05:29:10AM -0400, google000 wrote:

> I have tryeid to do something like this but it seems that variable
> $upstream_http_content_disposition is empty.. when I want to redirect to
> different url..
> proxy_pass;
> set $x $upstream_http_content_disposition;
> return 301$x;
> variable $x is empty..

This is not going work, as "return 301" will happen before the 
proxy_pass.  See here for basic explanation on how rewrite module 

It looks like you want nginx to do a request to upstream server, 
and then return a completely different response to a client.  In 
case of 200 responses, this is something that can be done, e.g., 
by using auth request module, see here:

It might also be a good idea to change your backends to actually 
return responses you want to be returned to clients instead of 
trying to change them with nginx configs.

Maxim Dounin

More information about the nginx mailing list