The following returns a gateway timeout on my vps (debian, squeeze)

 curl --head http://www.flipkart.com/
 HTTP/1.1 504 Gateway Timeout

But works fine i.e gives a 302 HTTP on my home computer. So I guess something is wrong in my vps settings. But what?

The same command was working fine yesterday.


Edit: PHP-cURL throws a 504 as well, which is how this problem was discovered..

Edit2: Other sites work just fine though:

 curl --head https://google.com 

Edit3: I can successfully ping to flipkart.com

  • Why do you think this is a problem with your VPS? – Michael Hampton Sep 25 '14 at 13:40
  • same command works fine i.e gives a 200 HTTP from my home computer. – gyaani_guy Sep 25 '14 at 13:45
  • That's funny, because I get an instant 504 error. Which means the remote site is doing something stupid. This isn't your problem. – Michael Hampton Sep 25 '14 at 13:46
  • But if the remote site can be accessed with a browser, it should be accessible from curl as well . right ? – gyaani_guy Sep 25 '14 at 13:51

Figured it out!! It was giving 504 when curl tries to resolve to ipv6

On comparing the requests, the only difference was the ip address.

So I tried forcing ipv4 resolving via

curl -4 --head  http://www.flipkart.com

and it worked!

  • See, I told you the remote site was doing something stupid. :) – Michael Hampton Sep 25 '14 at 14:06
  • Indeed. My solution is more like a workaround. – gyaani_guy Sep 25 '14 at 14:07

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.