TrebitschTheReal
TrebitschTheReal

Reputation: 101

Why can't I access my own Vue Webpack server via LAN from another device?

I'm a bit new on this ground, and this is my first question. I'm asking you, because I couldn't solve this problem for 2-3 days, not even after reading a lot of material around this problem. What I found:

I initialize my vue webpack project like this with using npmas vue init webpack

After it finishes, I change host: 'localhost' to host: '0.0.0.0', and also add disableHostCheck: true.

In config/index.js dev scope, and I start my server with -> npm run dev

Output:

Compiled successfully in 3070ms                   
Your application is running here: http://0.0.0.0:8080

If I type in my Ipv4 address to the browser with :8080, like xxx.xxx.xxx.xxx:8080 my projects is there. It's fine, but I can't see my project from another device, like laptop or mobile phone.

I don't really understand this, because I read that if we type in '0.0.0.0' to the host, it means everyone can get access to the project on LAN.

Could somebody tell me please why is this happening?

Upvotes: 2

Views: 7179

Answers (4)

Sayed Abdullah Qutb
Sayed Abdullah Qutb

Reputation: 35

I had the same issue and the reason was that port was blocked on my linux. I first checked which ports are allowed by running the following:

sudo ufw status

Then I saw that port 8080 was open to specific ip addresses, but it is the Vue web server, so I opened it for all ip addresses with the following:

sudo ufw allow 8080

You can also open ports 8081, 8082, ... if you have multiple servers running.

Source: https://www.cyberciti.biz/faq/how-to-open-firewall-port-on-ubuntu-linux-12-04-14-04-lts/

Upvotes: 0

Muhammad asif
Muhammad asif

Reputation: 41

I fixed this issue by changing Base_url from http://localhost:3000 to http://192.168.10.3:3000. My Express App and Vuejs app is both running on the machine with IP address 192.168.10.3. Now on another machine on the same network, the Vuejs app is running and this should send a request to the machine(IP 192.168.10.3) running Expressjs. Using ipconfig command in the command prompt, machine IP can be determined.

Upvotes: 0

TrebitschTheReal
TrebitschTheReal

Reputation: 101

Okay guys, i solved this. I will write down the solution, because its so funny and so annoying at the same time when you cant solve something, because of one little thing you dont even think of.

The solution: just enable your ports in the damn windows firewall :D

Now i can host everything, in lan, and public too.

Upvotes: 8

Dmitry Malugin
Dmitry Malugin

Reputation: 921

I suppose http://0.0.0.0:8080 available only locally, from machine where your project is running. To see project from another machine (and It should be in the same network it's important) you should obtain your real IP address (you can google how to do it, it depends on OS, on windows use "ipconfig" command in cmd) and then you should see your project in local network on URL which may look like this http://192.168.1.237:8080

Upvotes: 0

Related Questions