0

I use nginx reverse-proxy

When I use this code it works

location / {
        proxy_pass https://test.serverA.com;       
        proxy_redirect off;

    }

But when I use this code it doesn't work

set $sub test;
location / {
        proxy_pass https://$sub.serverA.com;       
        proxy_redirect off;

    }

Does anyone know the reason?

Joe
  • 11
  • 2
  • Use `nginx -T` to test the configuration file. Check the error log for details of the problem and describe what doesn't work. If you use a variable with `proxy_pass` you will need to define a `resolver`. See [`proxy_pass` manual page](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass). – Richard Smith Jan 24 '23 at 08:04

0 Answers0