67

If I access my web site via http://localhost:8080 from the same Win 7 PC, where server is running, then it works well.

If I try to access that from another PC (with usage of my internal PC's ip http://192.168.1.98:8080), then it doesn't work. Moreover, it is not accessible with this ip even on the same machine. What am I doing wrong?

(I've tried to disable firewall on my Win 7 PC - it didn't help)

LA_
  • 19,823
  • 58
  • 172
  • 308
  • possible duplicate of [Can access AppEngine SDK sites via local ip-address when localhost works just fine and a MacOSX](http://stackoverflow.com/questions/2168409/can-access-appengine-sdk-sites-via-local-ip-address-when-localhost-works-just-fin) – Nick Johnson Sep 26 '11 at 04:04
  • Having changed to 0.0.0.0, what do I set `LOCAL_APP_ENGINE_SERVER_URL` to? in android I mean – learner Feb 22 '14 at 02:02

13 Answers13

88

First check whether your server listens on loopback or on all interfaces - in command line type in netstat -an find a line with port 8080 and state LISTENING, something like this:

  TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING

If IP is 0.0.0.0 it means it listens on all IP addresses and the problem is with something else blocking it.

If IP is 127.0.0.1 then you need to bind to 0.0.0.0 address. And now the fun beings - according to documentation, you should add --address=0.0.0.0 or --host=0.0.0.0 to arguments in run configuration (depends on GAE version - thank you @momijigari). But in my case I have also GWT and parameters go to GWT and it does not accept this argument. But on the other hand listens on all interfaces, which I personally was trying to change to localhost. The GWT has -bindAddress parameter though, but it sets only address for code server (one with 9997 port by default), not HTTP.

okrasz
  • 3,866
  • 24
  • 15
  • 2
    Thanks, usage of `--address=0.0.0.0` helped. – LA_ Sep 24 '11 at 06:41
  • 13
    Note that newer versions of app engine dev server use --host instead of --address – xorgate Mar 24 '13 at 17:30
  • i get an error when trying this "dev_appserver.py: error: unrecognized arguments: --address=0.0.0.0 2014-01-17 20:42:57 (Process exited with code 2)" – momijigari Jan 17 '14 at 16:43
  • Ok I found a solution, Will write below – momijigari Jan 17 '14 at 16:46
  • 1
    I'm on gae version 1.8.9 and `--address=0.0.0.0` did the trick – AlikElzin-kilaka Feb 11 '14 at 16:14
  • 4
    For the new Google App Engine SDK (version 1.9.20) `--host=0.0.0.0` is the correct argument – Maksim Luzik Jun 01 '15 at 10:37
  • The latest version as of now (1.9.30) seem to work with `--address=0.0.0.0` – Josep Valls Jan 12 '16 at 20:12
  • If your using in android studio / Intellij , go to edit configurations then in address put 0.0.0.0 , you may need to uncheck sync with gradle file. It works for me , thanks :) – geniushkg Jun 24 '16 at 05:13
  • great! this solves my issue. I am trying to use Docker to run the Gcloud dev server and add this option to the command. – Xin Meng Apr 06 '18 at 07:10
  • `--host=0.0.0.0` "worked" for me, but then I get "Request host is not whitelist enabled for this server. Please use the --host command-line flag to whitelist a specific host (recommended) or use --enable_host_checking to disable host checking. See the command-line flags help text for more information." So I fixed it by specifying my current local ip address instead: `--host=192.168.8.166` – Jonny Apr 19 '18 at 01:50
  • 1
    If you're using gradle to run the server, it's also `host`: `host = "0.0.0.0"` inside the `run` struct. – Dan Gravell May 16 '19 at 16:08
20

Command line

Pass this program argument:

--address=0.0.0.0

Eclipse

Start your dev server with this extra program argument (you can find this under “debug configurations” in eclipse):

--address=0.0.0.0

Gradle

If you’re using appengine-gradle-plugin +2.0.0, then you need to set it like this:

appengine {
    host = "0.0.0.0"
    port = 8888
    ...

If you're using appengine gradle plugin before version 2.0.0, then you need to set it like this:

appengine {
    httpAddress = "0.0.0.0"
    httpPort = 8888
    ...

Maven

<configuration> 
    <address>0.0.0.0</address>
    ...
Community
  • 1
  • 1
matt burns
  • 24,742
  • 13
  • 105
  • 107
18

Little update. Since version 1.8.7 you have to set a param "--host" instead of "--address"

So just add --host=0.0.0.0

momijigari
  • 1,598
  • 2
  • 14
  • 28
5

I got it working using the suggestions above for --host=0.0.0.0. Here are the steps.

  1. While on the project go to Edit > Application Settings
  2. Add to Extra Command Line Flags

Google App Engine Settings

Added Extra Command Line Flags

Svetoslav Marinov
  • 1,498
  • 14
  • 11
  • Hey, thanks, this helped me when I set up the GAE Launcher on a notebook back in March (version 1.9.34)! However, when I try to do the same on a new notebook, with version 1.9.38, clicking Update does _nothing_. If anyone can confirm it still works on newer versions and that I'm not doing something dumb, I'd be grateful. – Berbare Jun 07 '16 at 18:45
4

If you are running devserver through maven add

<address>0.0.0.0</address>

under your

<configuration> 

section in your appengine-maven-plugin.

flosk8
  • 465
  • 1
  • 6
  • 17
  • Wish I had seen this earlier. Check out [all options here](https://code.google.com/p/appengine-maven-plugin/source/browse/src/main/java/com/google/appengine/devappserver/AbstractDevAppServerMojo.java?name=master). – Dominykas Mostauskis Aug 21 '15 at 15:32
3

For Google App Engine 1.8.9 (Java only), adding -a 0.0.0.0 for all interfaces, worked for me.

-a 0.0.0.0 --port=8888 "/home/dude/workspace-java/me.dude.thermo-AppEngine/war"
Rori Stumpf
  • 1,912
  • 19
  • 26
2

In Gradle build file:

appengine {
    httpAddress = "0.0.0.0"
}

(Gradle App Engine plugin)

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
1

Eclipse users can do the following in the GUI to implement the Command-Line Arguments:

Right click on project name -> Debug As (or Run As) -> Configurations... -> Arguments

In the Program arguments area replace

--port=8888

with

--port=8888 --host=0.0.0.0

or

--port=8888 --address=0.0.0.0

depending on the AppEngine SDK version, then also check port availability and software firewall settings.

Martin Berends
  • 3,948
  • 2
  • 16
  • 19
0

I'm using Eclipse.

I've tryied to add --address=0.0.0.0, but it didn't work for me.

Then I've removed --port=8888 entity from the command line arguments => server runs on default port 8080 and only then team members could connect to my machine via my IP address.

Finally, try to remove port entity and add --address=0.0.0.0 entity as it was described in early posts

dpr
  • 10,591
  • 3
  • 41
  • 71
Subtle Fox
  • 612
  • 7
  • 7
0

Step 1: Get the LAN IP

Goto your Windows Command Console (Press Win+R, then type "cmd"). In the console, enter "ipconfig". You will see a list of display. Under Wireless LAN adapter Wi-Fi, get the IPv4 Address. It will be something 192.168.x.x

LAN IP : 192.168.x.x

Step 2:

Go to Eclipse, Open the Configured server

GAE Development server config

Under Properties of GAE Development Server -> Local Interface address to bind to, enter the LAN IP address, and save.

Step 3:

Now you can access the GAE server by

http://192.168.x.x:8888/

8888 - Refers to the Port Number, as mentioned in the GAE development server

Prakash Ayappan
  • 455
  • 2
  • 8
0

-bindAddress 0.0.0.0

is what i needed. I added it just before the -port arg. This was via Eclipse

Trevis Thomas
  • 353
  • 3
  • 6
0

To access the GAE development server(Local Sever) withing LAN from any machine(PC/Mobile), you need to configure the app engine to accept request from any ip as follows;

Run Configuration -> Arguments -> Program Arguments

--address=0.0.0.0 port=8181

Note: You can use any available port.

enter image description here

Once this done, you can just access this local server by entering the PC's IP address and above configured port;

http://192.168.1.102:8181/

enter image description here

Aashish
  • 81
  • 2
  • 5
0

If using GWT, add this program arguments

-bindAddress 0.0.0.0
dragonalvaro
  • 703
  • 1
  • 10
  • 28