I
I
inm2013-10-23 12:41:38
Nginx
inm, 2013-10-23 12:41:38

NGINX configuration (location)… 502 Bad Gateway

There is a task to give files from another server through mine. Let's say that the habrahabr.ru/favicon.ico
file can be obtained on my website using the following link my_sair.com/nginx-download/habrahabr.ru/favicon.ico Added the following to nginx.conf:

location ~* ^/nginx-download/([a-z0-9\.\-]*)/(.*)$ {

  set $srv  $1;
  set $fn  $2;

  proxy_set_header Host $srv;
  proxy_set_header Referrer $srv;
  proxy_set_header User-Agent 'User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2';

  proxy_hide_header Content-Disposition;

  proxy_pass http://$srv/$fn;
  proxy_max_temp_file_size 0;
}

Now when I call any file _http://my_sair.com/nginx-download/habrahabr.ru/favicon.ico I get "502 Bad Gateway". The rest (my_sair.com) works without problems.
What did you do wrong? What to fix?

Thanks in advance for your help.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
Nikolai Vasilchuk, 2013-10-23
@inm

Here is a working config

location ~* ^/nginx-download/([a-z0-9\.\-]*)/(.*)$ {
        resolver 127.0.0.1; # DNS сервер
        set $srv  $1;
        set $fn  $2;

        proxy_set_header Host $srv;
        proxy_set_header Referrer $srv;
        proxy_set_header User-Agent 'User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2';

        proxy_hide_header Content-Disposition;

        proxy_pass http://$srv/$fn;
        proxy_max_temp_file_size 0;
}

D
Denis Ineshin, 2014-11-10
@IonDen

Forget Android.
If you are looking for an E-Ink reader, then there is nothing better than a Kindle.
For example Kindl Voyage

D
Dmitry, 2014-11-10
@Dimitriys

on android - nook glowlight (I own 2 such stitched ones),
but kindle paperwhite has a slightly better screen and backlight (there is 1 piece)
looked at large diagonals .... I resigned myself and use proven solutions.

A
Andrey Akimov, 2014-11-10
@Ostan

To read take Asus MeMo Pad HD 10" on Intel processor (without dialer)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question