Score:0

nginx reverse-proxy 502 (111: connection refused) while connecting to upstream

cn flag

I have the following nginx configuration:

server {

    listen: 8080;
 
    location / {
        proxy_pass           https://somehost.abc.xyz;
        proxy_redirect       off;
        proxy_set_header     Host somehost.abc.xyz;
        proxy_set_header     food pizza;
    }

}

When i hit the proxy i get the following error:

connect() failed (111: Connection refused) while connecting to upstream, client: aa.aaa.a.a, server: somehost.abc.xyz, request: "GET / HTTP/1.1", upstream: "https://xxx.xxx.x.x:443", host: "my-proxy.abc.xyz", referrer: "https://my-proxy.abc.xyz/"

The site https://somehost.abc.xyz is up and running, but for some reason the proxy doesn't work on this site and i get 502 bad gateway. On any other site it's working but not this one.

any idea what could possibly cause the error? and how to fix it?

Edit: also, why is it going to upstream in format IP:host (https://xxx.xxx.x.x:443), is there a way to make it go on format host:port

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.