H
H
HoHsi2016-03-31 18:29:29
Nginx
HoHsi, 2016-03-31 18:29:29

Why doesn't Nginx substitute variable in proxy_pass?

Good afternoon!
Why doesn't Nginx substitute variable in proxy_pass?
Now this part of the config looks like this:

server {
    # ...
    set $s3_server          "s3.eu-central-1.amazonaws.com";
    set $s3_bucket          "wtf";

    location / {
        expires                 30d;

        proxy_set_header        Host $s3_server;

        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;

        proxy_pass $scheme://$s3_server/$s3_bucket/;
    }
   # ...
}

But all requests fall into 404.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Burov, 2016-03-31
@HoHsi

See error_log for what exactly he didn't find there.
And it is worth updating to 1.9.13.
nginx.org/en/CHANGES

*) Bugfix: in the "proxy_pass", "fastcgi_pass", "scgi_pass", and
"uwsgi_pass" directives when using variables.

E
Eugene, 2016-03-31
@Nc_Soft

to use variables in the proxy pass write
resolver 8.8.8.8;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question