CURL throws 504 gateway timeout error with external website on the vps

504curltimeout

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.

Help!

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

Best Answer

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!