开发者

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

开发者 https://www.devze.com 2023-04-07 19:32 出处:网络
If I access my web site via http://localhost:8080 from t开发者_StackOverflow中文版he same Win 7 PC, where server is running, then it works well.

If I access my web site via http://localhost:8080 from t开发者_StackOverflow中文版he 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)


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.


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


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


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

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

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


If you are running devserver through maven add

<address>0.0.0.0</address>

under your

<configuration> 

section in your appengine-maven-plugin.


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"


In Gradle build file:

appengine {
    httpAddress = "0.0.0.0"
}

(Gradle App Engine plugin)


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.


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

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

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


-bindAddress 0.0.0.0

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


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.

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

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/

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


If using GWT, add this program arguments

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

0

精彩评论

暂无评论...
验证码 换一张
取 消