Welcome! Log In Create A New Profile

Advanced

Special headers and X-Accel-Redirect

Kamil Gorlo
June 06, 2011 09:16AM
Hi guys,

I have small problem with file download using X-Accel-Redirect. I am
using Nginx as proxy before some REST API application, some of the
requests are for big files which are located at other host - so I am
using X-Accel-Redirect to download them. But I have also some metadata
connected with file which I want to return in X-metadata header from
REST API.

So, here is my config:

server {
listen 80;
listen 443 ssl;

server_name some-service.pl;

ssl_certificate /etc/ssl/certs/some-service.pl.pem;
ssl_certificate_key /etc/ssl/private/some-service.pl.key;

client_max_body_size 100M;
client_body_buffer_size 128k;

location / {
if ($http_x_user = "") {
return 502;
}

proxy_pass http://api;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for; # client, proxy1, proxy2, ...

}

location /files {
internal;
rewrite ^/files(.*)$ $1 break;

proxy_pass http://filestore;
proxy_hide_header Content-Type;
proxy_hide_header Content-Disposition;

set $x_metadata $upstream_http_x_metadata;

add_header X-metadata $x_metadata;
}
}

I am using this trick with set to temporary variable and add_header
with this variable (which I've found somewhere on this list), but this
is not working. Even simple:

set $x_std "testest";
add_header X-metadata $x_std;

does not work for me.

Could please somebody tell me what could be wrong?

Thanks,

--
kgs

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Special headers and X-Accel-Redirect

Kamil Gorlo June 06, 2011 09:16AM

Re: Special headers and X-Accel-Redirect

Kamil Gorlo June 06, 2011 09:18AM

Re: Special headers and X-Accel-Redirect

Kamil Gorlo June 06, 2011 10:36AM

Re: Special headers and X-Accel-Redirect

António P. P. Almeida June 06, 2011 10:42AM

Re: Special headers and X-Accel-Redirect

wideawake August 28, 2012 07:43PM

Re: Special headers and X-Accel-Redirect

Igor Sysoev June 06, 2011 11:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 268
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready