Nginx proxy_pass proxies to the same server

The trouble is that I am setting the Host to $host in location /a_test. It needs to be set to "DomainB.com" instead.


you missed the "/" at the end

https://dev.to/danielkun/nginx-everything-about-proxypass-2ona

location /a_test/ {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_pass http://DomainB.com/b_test/;
}