When I start a webserver on my machine (on port 80), and then try to access it via my public IP, I get HTTP error 504 (Gateway Timeout).

Why ?

This only happens when I am connected to the internet via Android.
When I connect via normal ADSL, everything works fine.

Is there any way to enable this ?
If Android was a router, I'd say I need to port-forward.
But it's strange I get HTTP 504 then.

Anybody knows ?

  • Check your web server logs. Can you find your request in the access log in both cases? – Khaled Dec 24 '11 at 8:06
  • No, the request doesn't get to the server, that's the problem. – Quandary Dec 24 '11 at 8:53
  • You need to check the connectivity between your client and your server. – Khaled Dec 24 '11 at 8:55
  • How exactly are you "connected to the internet via Android"? What software are you using? What mode is it in? – David Schwartz Dec 24 '11 at 9:05
  • @David Schwartz: I'm using Ubuntu Linux, I connect to the internet via the Android phone that I connect to the Ubuntu Laptop via USB. I open the browser on the Ubuntu Laptop, and type in the public IP (first I start a web server on the Ubuntu machine). – Quandary Dec 24 '11 at 9:13


The Android architecture does not allow to start communication from the Android to the host through the USB cable.The opposite is possible, using the Google "Android Debug Bridge" (ADB in short).


  • I really doubt he's using ADB. It's much more likely he's using tethering. – David Schwartz Dec 24 '11 at 9:16
  • Yep, he has confirmed he's not using ADB. So the architecture of ADB isn't relevant. – David Schwartz Dec 24 '11 at 9:23
  • @David Schwartz: You're missing that the Phone is connected to the computer via the USB cable. – Quandary Feb 3 '13 at 13:24

You're exactly right. If it was a router, you'd need to do port forwarding. Unfortunately, the routing is done on a machine you have no access to, maintained by the provider. So there's no way you can arrange to have port 80 forwarded. Likely they couldn't do that anyway because that port seems to be used for some other purpose -- whatever is issuing the 504 error.

Your only solution would be to use a VPN.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.