How to save into variable proxy header response?

Maxim Dounin mdounin at mdounin.ru
Sat Apr 19 19:37:11 UTC 2014


Hello!

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

> 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 ?

The Content-Disposition header value from upstream response is 
available as $upstream_http_content_disposition variable (see 
http://nginx.org/r/$upstream_http_).  The map module can be used 
to extract part of the value, see http://nginx.org/r/map.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list