Bryce Cutt
Bryce Cutt

Reputation: 1525

How do I find out what the IP address is for a domain name on Google App Engine?

I need to figure out which IP address my application is actually connecting to when it makes a urlfetch to a provided domain. My application on the production server is having problems connecting to a domain but connecting works perfectly fine using the SDK on my computer. I am trying to debug this problem and it occurred to me that Google App Engine may be resolving the domain to a different IP address than my local computer is.

If I had access to the socket library this would be as simple as socket.gethostbyname('thedomainiwant.com') but unfortunately Google does not allow the socket library on App Engine.

Any ideas?

If there is a solution that requires Java or Go on App Engine I am willing to try that too.

Update June 26, 2011:

I changed the production code to use the IP directly right away just to get this working (and it did) but this is not a good long term solution as I don't control the server I am making urlfetches to so the IP may change on me without warning.

Returned headers would not be helpful in this case because whatever IP address the production instance is resolving the domain to is not responding at all and the request times out.

If the server I am doing urlfetches to was blocking App Engine then doing an urlfetch by IP would not work either...but it does work. Also, I talked to the team managing the server and they confirmed they are not blocking App Engine. I am still pestering them for more info but it does not seem to be a problem on that end.

Update July 7, 2011:

Google has confirmed that there was a problem on their end that affected my application. They have applied a work around and are working on a fix. See here: http://code.google.com/p/googleappengine/issues/detail?id=5244

Upvotes: 3

Views: 870

Answers (3)

okrasz
okrasz

Reputation: 3974

You can use web services that perform DNS lookup. You can embed the address in the URL, like this:

http://www.dnswatch.info/dns/dnslookup?la=en&host=HOST_HERE&type=A&submit=Resolve

(replace the HOST_HERE) and then parse the result. Unfortunately it is HTML, but even simple regex should make it. You can also try find some service, which allows some XML output or so - there are a lot of such services, just type "dnslookup" in Google, someone might have it.

Upvotes: 0

Nick Johnson
Nick Johnson

Reputation: 101149

There's currently no way to do name resolution on App Engine. You'll have to call an external service over HTTP if you want to do that.

Upvotes: 1

Jan Z
Jan Z

Reputation: 612

Take a look at the response headers, you might get a HOST header back with exactly this info.

Otherwise, why not just use the raw IP's for your connections while you're diagnosing this?

Upvotes: 0

Related Questions