I've upstream in my http block:
upstream backend.example.com {
server 127.0.0.1:443;
}
And within the frontend's server block:
location ~* ^/special {
proxy_pass https://backend.example.com;
include /etc/nginx/conf.d/proxy.conf;
}
This appears to work fine when backend.example is hosted by Apache or is on another box. When frontend and backend are "virtual hosts" listening at the same address and port, Nginx returns a 502 Bad Gateway (misconfiguration) error.
Is Nginx capable of proxying to itself, and resolving its destination based on the server name?