Answer the question
In order to leave comments, you need to log in
Using variable in proxy_pass?
There is nginx 1.014, it is necessary to proxy depending on the subdomain to a specific machine within the network.
On the Internet, examples of the form are everywhere:
location /proxy {
resolver 8.8.8.8;
set $target http://proxytarget.example.com;
proxy_pass $target;
}
location / {
set_by_lua $target "return string.gsub(ngx.var.host, 'host.ru', '-host')";
proxy_pass $target;
proxy_set_header Host $host;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question