I am getting connection timed out - 502 when connecting from one Internet connection (wifi 4g connection tried with different devices and browsers) while the server works perfectly on VPN, and different Internet connections (tried on several cell networks).
My nginx config is
location ~ /([a-zA-Z0-9]+)$ {
rewrite ^/([a-zA-Z0-9]+)$ /?page=$1 break;
proxy_buffering off;
proxy_pass https://slickalpha.com:443;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
There is another website on the same server, which is loading fine from this connection. And there is no entry on error log or access log of nginx. Please help.
Update:- So after lot of tests, I came to realize the issue was not because of proxy settings but the ipv6 resolving problem. Ill explain further as an answer.
After spending days and nights on this, I figured out that my internet connection was giving preference to the ipv6 network found on my domain's AAAA record. The fault was on my ipv6 network in establishing a connection with the ipv6 (AAAA record) address of my server, while it was able to resolve (A) record properly. Found this using windows cmd command tracert. To test the ipv6 connection,
and for ipv4
I also verified that my server dns were working fine, by doing a debug using the windows cmd command nslookup, like
So it was clearly an issue with my ISP. As such issues could occur at clients end, I had to do a quick fix, by removing the AAAA record from my domain, so that all traffic goes only through the ipv4 address. Will update further if i find a permanent fix.