Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emulator can't connect to Google App Engine dev server

In my Android emulator, I was able to contact the GAE dev server. I use this url: "http://10.0.2.2:8080/myurl". The server is listening on http://127.0.0.1:8080.

Then, after I've updated the emulator to the Nexus 5X version with Google Play(API 27), the connection fails and the server show this log:

ERROR 2018-01-11 11:17:05,463 wsgi_server.py:329] Request Host 10.0.2.2 not whitelisted. Enabled hosts are set(['127.0.0.1'])

I'm using the latest GAE python SDK with webapp2.

Any idea on how to solve the problem?

like image 547
Blodhgard Avatar asked Jan 11 '18 10:01

Blodhgard


1 Answers

The more recent versions of the development server includes whitelisting checks of the source IP address of incoming requests.

You can use the --enable_host_checking=False command line option for the GAE devserver, which disables these checks. Not a good idea if you're running on an untrusted network.

You're probably seeing such errors even for accessing the devserver from the same machine. Another option for these requests would be to use the --host 10.0.2.2 devserver option (i.e. use your machine's external IP address instead of localhost/127.0.0.1, but that won't help with the emulator requests if you're running the emulator on some other machine.

Ideally the whitelist should IMHO be manageable independently from the server's IP address, but this is what is available presently.

like image 172
Dan Cornilescu Avatar answered Nov 14 '22 22:11

Dan Cornilescu