0

I have 2 server first (domain.com) is a django/apache server, second (f1.domain.com) is a file server (nginx) where some files are protected and should be allow download only to registred user, so i have setup a nginx server with a

server {
        listen 80 default_server;
        server_name *.domanin.com;
        access_log /home/domanin/logs/access.log;
        location /files/ {
             internal;
             root /home/domanin;
        }
}

and from django I send a request via X-Accel-Redirect header, but dosen't work i think because come from a remote server, how can i accomplish my task?

regards!

phingage
  • 3
  • 3

1 Answers1

1

You need to get the remote URL Host and URI pass it to proxy

location ^~ /redirect {
location ~ "^/redirect/(.*)/(.*)" {
resolver 8.8.8.8;
# internal;
include proxy_params;
proxy_pass http://$1/$2;
# echo proxy_pass;
# autoindex on;

# alias /var/www/;
}
}

The following links are excellent answer for your question.

Nginx X-Accel-Redirect Remote URLS

Nginx X-Accel-Redirect with resolver to resolve domain names

  • 1
    Could you please cite the relevant content of the linked examples? StackExchange sites try hard to prevent linkrot, so in the interests of posterity, please expand your answers. – Deer Hunter Jan 10 '13 at 11:57