Why can't I access my local Gatsby site on my phone - windows-10

I am new to Gatsby, and I will be starting my first project today. I want to be able to test the site on my android phone to ensure mobile compatibility rather than using chrome dev-tools.
I have only ran a few commands so far.
1) Gatsby new site-name
2) cd site-name
3) gatsby develop --host 0.0.0.0 -p 8080
Everything compiles properly, and I can access the default Gatsby page through localhost:8080 or 192.168.1.81:8080 on the host laptop, but when i attempt to access from my android phone, it says that the server is unreachable. I am running windows 10 on my laptop, and so far Ive checked the firewall, and I've tried a few different ports as well. If someone has dealt with this issue and could help me that would be much appreciated!

I don't know why they blocked access by default :/ But you can access it by adding -H 0.0.0.0 to develop command. For example change your package.json to:
"develop": "gatsby develop -H 0.0.0.0",

you can fix this issue by using this command
gatsby develop -H 0.0.0.0
more information : from here
after you can use your pc ip address with the port number to debug gatsby site on your mobile
Example :
192.168.1.4:8000

I had to do:
gatsby develop -h 192.168.xx.xx -p 8080

Your phone and and the computer you are running from needs to be on same wifi/network. I need sometimes to reconnect my phone to the wifi to get it right. Suppose it has to do with the private ip adress the router is assigning to devices.
Then 192.168.1.xx:8000 can be opened on phone browser.

Related

ng serve | Will not cast to ther devices

I run my app to my local machine via ssl like this:
ng serve --ssl --host: 0.0.0.0
so it is up at: https://localhost:4200
I also using my ipv4 adress which is: XXX.XXX.XX.XXX to make my requests to the server via my services, so i make my api calls like this: https://XXX.XXX.XX.XXX:80/api...
In my back end, I have created an https server so my API calls are been made via https
Everything works great to my desktop
Problem is: The app wont cast to ther devices.. it wont even load and
after some time i get the msg this site cannot be reached
The built in webpack server that is used for ng serve is not meant for production or sharing to other computers, it is only supposed to work on local for development because of security reasons. You should consider hosting a compiled version with a separate web server such as nginx. If you absolutely NEED the built in webpack one to work, you can force it to bind to all of your IP addresses with this:
ng serve --host 0.0.0.0
You may need to disable the host check as well:
ng serve --host 0.0.0.0 --disable-host-check
You can access this, but you might need to turn off your Firewall, this mostly happens in windows machines.
Try turning it off and accessing the IP from other machine.

can not access http://192.168.56.1:3000 from mobile device while using browsersync

I have installed browsersync using command npm install -g browser-sync in windows 10 x64. nodejs version 10.11.0 browsersync version 2.26.3
everything is working fine in desktop. but when i try to access http://192.168.56.1:3000 from mobile device using same wifi, i get "this site can't be reached"
i have installed another tool named dev-ip which returns this in powershell:
[ '192.168.56.1', '192.168.0.120' ]
the ip series 192.168.0.120 used to work fine in my mobile devices.
now, how to use the ip 192.168.0.120 instead of 192.168.56.1 in browsersync globally?
Just specify the host in your configuration that you want the server to run on.
Eg. In you case it would be
host: "192.168.0.120"
You can refer to the link below for more information.
https://www.browsersync.io/docs/options#option-host
Hi, guys. This is how it worked for me:
Source:
windows 10
all firewalls are closed
network access (from windows) to the PC is disabled
external url from gulp 192.168.56.1:3000
proxying local php site from OpenServer
external device - iphone safari/chrome
external (virtual) device - vwware with macos
make sure that Windows Defender firewall monitor in high-risk mode -> rules for incoming connections -> Node.js: Server-side JavaScript is enabled (and other necessary apps)
Solution:
look at what ip address in the home network my PC has (all devices are connected to the same network) - for example 192.168.1.103
in the gulp file I specify it host: "192.168.1.103",
save
checking it out
Important:
for source - external device - iphone safari/chrome - correct url is only 192.168.1.103:3000
for source - external (virtual) device - vwware with macos - correct urls is 192.168.1.103:3000 and 192.168.56.1:3000 both
Visually in pic:
Result:
Checked on all devices, in virtual devices, on the PC itself
browsersync works
the Internet is not lost
there is no address conflict within the network
Hope this will help someone too 🙂
You don't have to change the settings.
run cmd using Administrator
run ipconfig
copy IPv4 address like 192.168.43.52
Now open google on mobile and add http:// at the front and :3000 or :5500 at the back.
like run http://192.168.43.52:3000

Node web server not visible externally, but Python is (MacOS)

I'm just starting to build an Ionic 2 app, but I can't get it working on my mobile device.
Python (works)
To demonstrate that the phone can see the host, I tried a Python server:
$ python -m SimpleHTTPServer 8000
Serving HTTP on 0.0.0.0 port 8000 ...
If I go to http://192.168.8.101:8000 on my phone, it connects fine and displays the directory listing.
Node (fails)
However, when I start Ionic:
$ ionic serve -p 8000
[...]
[INFO] Development server running
Local: http://localhost:8000
External: http://192.168.8.101:8000
I can load it in my host's web browser, but I can't see it from my phone nor another computer (it times out). I also tried a basic node server:
$ npm install http-server -g
$ http-server -p 8000
Starting up http-server, serving ./
Available on:
http://127.0.0.1:8000
http://192.168.8.101:8000
With the same result as Ionic: accessible from the host, but not from the phone.
Is there something blocking the request? Or is there some Node configuration I'm missing? I'm new to both Mac OS and Node, so I don't know where to look.
Embarrasingly, this turned out to be a firewall issue. In System Preferences > Security & Privacy > Firewall > Firewall Options, Node was explicitly set to deny incoming connections:
Changing it to Allow has fixed it. Phew!
Just execute ionic address and you'll get an IP address in your command line. Try with that ipaddress:port number from your mobile which will enable you to access your site from your phone.
Just incase if the ionic address command doesn't return anything, you need to execute the below command to point it to your ip,
ionic serve --address YOUR_IP_ADDRESS
Hope this helps!

how to run nodejs app in vps with plesk enable

Hi guys im newbie in vps... I've bought an ovh not managed vps . I like to face problems... But I don't find any documents to these one. Is simple like I said I want to run a nodejs app in centos vps environment but I have enabled plesk.. and I saw in console running the app with the trace but I try to open website with the port and doesn't find anything.
http://vps406315.ovh.net
Thx for all guys
-----------------EDIT-------------------
I'm going to explain better,sorry for previous post.
There is no error, in my console all is ok. Like I said i have an CentOS VPS. Steps that I did:
Connect with PUTTY
Go to folder where is the NodeJS project.
I set the port to 8080
Write node index.js
The app is running and writing the right trace.
I use chrome to check the ip, and show me the default plesk page.
I use wget to check it, and with only http://92.222.71.137/. I attach
an screenshot
I tried to use with the port 8080 with the chrome and wget in putty,
and the response was the same.
In the other hand if I use http://92.222.71.137:8080/login with putty
download the right login.html, and the nodejs app write a trace
indicate me that someone connect to that page. But if I access with
chrome is not working.
Now I would like no know how to make access frome Chrome.
Thx 4 all and sorry for my newbie knowledge
You should give some other details on the configuration or eventual errors you get (both on the browser and the VPS) and how you run the node app (behind a web server, for example)
If you are not running you node app behind a web server, are the node app listening on the correct interface ? 127.0.0.1 and 92.222.71.137 (your site external address) are not the same.
On your VPS you can try to call the node app from the VPS itself using wget or cURL and looking for what happen in the app trace.
Finally it was easy... only i had to open a port to use with TCP, using
iptables -I INPUT -p tcp --dport 8856 --syn -j ACCEPT –

Can't see my server on an azure vm

I have an Azure vm with Ubuntu 12 and I want to make an Angular2 server with angular-cli. When I run ng serve --port 80 I just can't see the page with a browser. When I check with CURL from the vm I can see the HTML properly but I get an error when I try to see it from the internet.
The strangest thing is that anything else I try works perfectly, I also have an old node server on the vm and when I run that I can see it normally from CURL and from the internet.
Okay so apparently I needed to specify host : sudo ng serve --host 0.0.0.0 --port 80.
github.com/angular/angular-cli/issues/2375
Thanks to evilSnobu.

Resources