localhostmamp

Why is localhost returning "502 Bad Gateway"?


When I googled this issue, I noticed this is a common issue with nginx. But I never used nginx in my machine. I work with MAMP and occasionally with Python Bottle.

Now whether my MAMP/Python server is on or not, I always get "502 Bad Gateway" whenever the address bar URL contains the word "localhost". Hence, I am having to use "127.0.0.1" in the meanwhile.

I am really confused as I have no idea which particular event has caused this issue to start happening in my Mac OS X v10.7.5 (Lion).


Solution

  • I just had this issue myself with MAMP - visiting localhost:8888/anything gave me a 502, but 127.0.0.1 worked fine.

    I discovered that it was my VPN (Hotspot Shield in this case) causing the issue (although I'm not sure why). I disconnected from the VPN and localhost works fine again.