Live Server: This page isn’t working 127.0.0.1 - liveserver

I got the message when I use live server at VS code.
This page isn’t working 127.0.0.1
I checked use local up option. but it still doesn't working.
I tried changing live server : host ip address to my ip address. But it still doesn't working.
what can I do?
*use local ip as host option picture:
https://i.stack.imgur.com/COq2I.png

In your given image, you have checked the option that hosts the liveserver on your IP, so you should have a look at yourip:port.
For example, if you is 10.43.156.141, and post is 5500 then
the server will be on http://10.43.156.141:5500
EDIT
To get your IP
If you are using Windows, use:
C:\User>ipconfig
If you have Linux, use:
$ ifconfig
Or just visit https://api.ipify.org/ to get your IP.
Note: When you visit https://api.ipify.org/ disable your VPN or Brave Shield or any Privacy Booster if you have
Edit:
The port is shown here
Edit the port in the live server
If you dont know the port, just add the below code in vscode's settings.json
"liveServer.settings.port": 5500
Change the 5500 to the port you want. Mostly 5500 is used.

Try using IPv4 Address.
Fo example if your IPv4 Address is 172.31.96.1 and your file name is index.html, Then change the URL in the browser from http://127.0.0.1:5500/index.html to http://172.31.96.1:5500/index.html

Related

Can't find which port to use in port forwarding

I have a webserver with different IP address from my LAN.
webserver - 133.3.33.166
internal network ip (local host) - 192.168.1.10 (xampp)
I need to run an app online hosted in my localhost. Currently I am using ngrok link inside an HTML iframe tag in my webserver to access those apps inside my local server. After I installed SSL in my webserver, apps can not be access anymore. No error messages, only a blank white page in my browser.
I need to find what port I should use for port forwarding if it is possible. Thanks.
Tried some ports I found using netsh -ab. PLease help.

live server vscode on another computer

I have 2 computers. when I open the project with live server on the first one it gives me this url 127.0.0.1:5500/index.html
I want to put that url on the other computer's browser but it doesn't work.
is there any solution to this?
This is what worked for me in VS Code:
1.- Go to your extensions option:
2.- Make sure you have the "Use Local Ip" option checked:
3.- Check on your terminal for your local Ip address (ipconfig on windows for example) and substitute the ip address from your live server url with you local ip:
You can try port forwarding using powershell on the hosting computer. I use wsl2 and when I want a preview on another computer I port forward using powershell
netsh interface portproxy add v4tov4 listenport=xxxx listenaddress=(host pc ip address) connectport=yyyy connectaddress=(wsl2 ip address)
In your case try making the listenaddress and connectaddress the same (which is your main pc) and the listen and connect ports 5500 using the above script.
After that the last step you should perform is add Inbound Rules inside your firewall.
you can go to settings live server and check the use local ip option, then you stop live server and start over again.
Now live server use an direction with local ip and you can open your file in other pc.
enter image description here
It doesn't work because you are using loopback address (127.0.0.1), in order to access your live server on entire LAN you need to change this address in vscode/liveserver settings to your private address, it will be something like (192.168.100.XXX)
put port 5500 in firewall to access from other pc
connect pc via lan and set static ip
then call it like xxx.xxx.xxx.xxx:5500/
You need nothing extra.
Just type your local IPv4 Address which you can find in Command Prompt by typing " ipconfig ", then on another computer in browser type this IPv4:5500 and it's done.
(You must have Live Server On)
Example: 192.168.1.5:5500

How can I see what http traffic to a localhost in Xcode

I have setup proxyman to see http request/response from my app to a remote host in Xcode.
My question is how can I do that for localhost? I don't see anything in Proxyman when I change my app to talk to a local host. And I don't see anything in the Xcode 's networking' tab either.
Thank you.
Follow the Proxyman's troubleshooting guide for this very problem: https://docs.proxyman.io/troubleshooting/.local-doesnt-appear-in-proxyman
By default, you can see any localhost traffic on Proxyman since the traffic doesn't go through Proxyman Server at port 9090.
To fix it, you should map the localhost to any fake domain in /etc/hosts file
Open /etc/host file with any Text Editor (Vim or Sublime)
Add
127.0.0.1 my-website.dev
or
0.0.0.0 my-website.dev
my-website.dev is a fake domain, you can choose any domain you like
Finally, you can access your localhost by using new fake domain.
http://localhost:3000 -> http://my-website.dev:3000
http://localhost:3000/v1/user -> http://my-website.dev:3000/v1/user
They will appear on Proxyman as usual
You can read a Doc at: https://docs.proxyman.io/troubleshooting/couldnt-see-any-request-from-localhost-server

Server Connection with public IP

I have setup a simple HTTP java server running locally on port 8000. It simply prints a message "Hello world" when a request comes. When I try to ping it from the browser by running http://localhost:8000/test I get my message printed.
I want to get the same results from another computer that is not local. When I try to use my public IP lets say http:/43.xxx.xxx.xxx:8000/test (even from the same machine) I get an ERR_CONNECTION_REFUSED .
I probably suspect that has something to do with the firewall. Can anyone guide me a little more because I lack the experience?
Thanks in advance
You don't specify what host OS your server/firewall is running so I'll keep this generic...
Without knowing your application, it seems like the server is sending a reset (RST packet) when the first SYN packet shows up indicating that the port (on that interface [your external]) is closed. You can do a quick port scan from here (https://mxtoolbox.com/PortScan.aspx) if you don't have access to a remote machine to test with. Odds are, TCP/8000 will not be open.
If it is, in fact, closed, you'll have to look at the firewall that your host OS is running and find out how to allow TCP/8000 to your host. In a major firewall vendor, your rule would look similar to this:
Source: Any
Destination: Your Public IP Address
Service: TCP/8000
Action: Allow
Logging: Full
That being said, you mentioned this was a PC so look into "iptables" (if you're running *nix) or the Windows Firewall (if you're running Windows) on adding firewall rules (Unfortunately I just joined and can't ask questions/comments, yet).
If you really want to find out what packet is being sent, run a tcpdump on your external interface (let's say eth1) (assuming your remote IP is 1.2.3.4 and your home public IP is 4.5.6.7):
tcpdump -nn -vvv -e -s 0 -X -c 100 -i eth1 host 1.2.3.4 and host
4.5.6.7 and port 8000
Here you're looking for the SYN/SYN-ACK/ACK for a successful TCP negotiation or SYN/RST if there is a firewall rejecting (not dropping) the TCP stream to the port.
Once the port is open on the host OS firewall, take a look at the application to make sure it's configured properly. If this were a standard webserver, you could take a look at the configuration files for the "Allow from" directives to make sure that everyone can access the site. If this is a custom application that you've created, you'll have to check this yourself.
I finally solved my problem. I needed to open a forwarding port in my router that maps my local ip address to the public. My router is TP Link so this what I did:
http://www.tp-link.com/us/faq-72.html
Also in order for this to work every time and not to have to reconfigure this every time I reconected to the router (because I get a new local IP), I have created a static local ip for my server following this guide:
http://www.tp-link.com/us/faq-182.html
Thanks for all the replies.

Open the localhost website from a server pc

This might be an easy question, but I am not familiar with these stuff.
Basically I have a server pc that I connect through my pc, and there is this webpage http://localhost:8080/. I can only access this address when I log in my server pc. Now I wanted to know how I can access this webpage in my pc (without having to remotely connect to my server pc). Any help will be appreciated.
you can access to your website (if your web server accept external requests) by type this code to your browser address bar from your pc:
<server ip>:8080
replace
<server ip>
with your server ip like this:
192.168.1.10:8080
Okay, so quick networking 101, localhost is a hostname that maps to the IP address of of 127.0.0.1 and these point to the local machine, i.e. your server.
In order to access that page within the same network, you'll need an external IP address. So say you're in the network of 192.168.1.0/24 and the server is on IP address 192.168.1.100. So in order to access your stuff from another machine, simply replace localhost with that IP and it should work. If not, you've got firewall issues, and those are another topic.