How to save into variable proxy header response?

Hello I’m using nginx as reverse proxy for some domain … my
configuration
for domain looks like that :

server
{
listen 80;
server_name www.mydomain.com mydomain.com;
index index.html index.htm index.php default.html
default.htm;
location / {
proxy_buffering off;
proxy_max_temp_file_size 0;
proxy_pass http://www.domainresultget.com;
}}

response header from this domain “www.domainresultget.com” looks like
that

HTTP/1.1 200 OK
CF-RAY: 11d864fce3900a9c-PRG
Connection: keep-alive
Content-Disposition: attachment; filename=“filename_title_download.exe”
Content-Length: 351744
Content-Type: application/x-msdownload
Date: Sat, 19 Apr 2014 10:24:48 GMT
Server: nginx
X-Powered-By: PHP/5.3.3

I want to save filename title in to variable for future use ? I mean
this
one “filename_title_download.exe” I want to save this in to variable…
Can
someone explain me how to do this ?

thank you so much, and sorry for my english.

Posted at Nginx Forum:

Hello!

On Sat, Apr 19, 2014 at 01:49:51PM -0400, google000 wrote:

proxy_buffering off;

Content-Disposition: attachment; filename=“filename_title_download.exe”
Content-Length: 351744
Content-Type: application/x-msdownload
Date: Sat, 19 Apr 2014 10:24:48 GMT
Server: nginx
X-Powered-By: PHP/5.3.3

I want to save filename title in to variable for future use ? I mean this
one “filename_title_download.exe” I want to save this in to variable… Can
someone explain me how to do this ?

The Content-Disposition header value from upstream response is
available as $upstream_http_content_disposition variable (see
Module ngx_http_upstream_module). The map module can be used
to extract part of the value, see Module ngx_http_map_module.


Maxim D.
http://nginx.org/

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 domaintest.com;

variable $x is empty…

Posted at Nginx Forum:

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 domaintest.com;

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:

Module ngx_http_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:

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 D.
http://nginx.org/

Can someone help me with configuration how to grab this filename and
save
into variable using map module ? I’m trying 2 days and still not working
for
me :((

Posted at Nginx Forum: