Is there any way to access GAE dev app server in the local network?

こ雲淡風輕ζ 提交于 2019-12-17 07:13:33

问题


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)


回答1:


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.




回答2:


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>
    ...



回答3:


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




回答4:


If you are running devserver through maven add

<address>0.0.0.0</address>

under your

<configuration> 

section in your appengine-maven-plugin.




回答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




回答6:


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"



回答7:


In Gradle build file:

appengine {
    httpAddress = "0.0.0.0"
}

(Gradle App Engine plugin)




回答8:


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.




回答9:


I'm using Eclipse. I've trying to add --address=0.0.0.0, but it doesn't worked 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




回答10:


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

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




回答11:


-bindAddress 0.0.0.0

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




回答12:


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.

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/




回答13:


If using GWT, add this program arguments

-bindAddress 0.0.0.0


来源:https://stackoverflow.com/questions/7534967/is-there-any-way-to-access-gae-dev-app-server-in-the-local-network

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!