How to save into variable proxy header response?
Maxim Dounin
mdounin at mdounin.ru
Mon Apr 21 10:55:46 UTC 2014
Hello!
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 http://www.domainresultget.com;
> set $x $upstream_http_content_disposition;
> return 301 http://domaintest.com/test.php?x=$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
works:
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html.
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:
http://nginx.org/en/docs/http/ngx_http_auth_request_module.html
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
http://nginx.org/
More information about the nginx
mailing list