502 on Mobile Devices
Hi,
When I access my site with my phone I'm receiving a 502 error, but from my computer it works.
1 Reply
Hello,
Mobile providers often prefer IPv6 over IPv4, if you have AAAA records configured for your domain your mobile provider is using those first. Since you're getting a 502 rather than a connection refused we know that Nginx itself is configured to respond on IPV6 to some extent.
curl -4 -IL example.com
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Tue, 03 Apr 2018 23:37:33 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 2626
Connection: keep-alive
X-Frame-Options: SAMEORIGIN
curl -6 -IL example.com
HTTP/1.1 502 Bad Gateway
Server: nginx/1.6.2
Date: Tue, 03 Apr 2018 23:37:53 GMT
Content-Type: text/html
Content-Length: 172
Connection: keep-alive
Your /var/log/nginx/error.log or /var/log/nginx/error_log should contain more detailed information about the 502 you're receiving. If you're proxying another application through Nginx you should ensure that Nginx is listening for the application on IP/port combination. You can use the following command to view what applications are listening:
sudo netstat -plntu
https://www.cyberciti.biz/faq/nginx-ipv6-configuration/