connect ECONNREFUSED to WSL2 ubuntu-18.04 - wsl-2

I'm runing my flask project use wsl2 interpreter, and runing my vue project in my windows local, now there is a problem, yhr frontend can not connect backend, like below
Proxy error: Could not proxy request /summary_statistics from localhost:9527 to http://172.28.32.1:9999/
172.28.32.1 is my wsl2 ip.
anyone can help?

I have solve the problem, the IP is wrong..., I got from powershell with command
ipconfig
but I got another ip address in wsl with command
ifconfig
the true ip address is the second.

Related

Cannot access to WSL2 port opened via IPv6 from Windows host

I have a node-server running at WSL2 Ubuntu-20.04.
netstat -tulpn in WSL shows the following ports:
The ports specified as 0.0.0.0:8080 can be accessed in both WSL and Windows via 127.0.0.1:8080 url
My issue is that the ports specified as :::3006 can be accessed via 127.0.0.1:3006 only inside WSL, but from Windows, it works only via the network URL like http://172.28.100.200:3006.
When I send the request to 127.0.0.1:3006 from Windows, there is no connection error, but the server inside WSL does not receive it while using the network address, it does.
How can I investigate this and make the Windows port at 127.0.0.1:3006 forward requests into the same port in WSL?
UPDATE:
So I solved this by adding a port proxy, but again, WSL network IP is needed for this to work:
Any chance to avoid using network IP?

NodeJS and React - LAN connection not working

Description
I have a Node server and React App running on my notebook Ubuntu 18.04.
Notebook ip is 10.0.0.101
I tried to connect my desktop to this server on the same network
Desktop ip is 10.0.0.100
Node is running on PORT=3333
React is running on PORT=3000
I can ping my notebook from my desktop but when I try to connect to node using Insomnia or to http://10.0.0.101:3000 from my desktop I cannot reach.
Errors
When try to connect to backend with Insomnia
Error: Couldn't connect to server
When try to connect to app on 10.0.0.101:3000
ERR_CONNECTION_TIMED_OUT
What I've done
I already changed the node listen and specified the port and the ip but it didn't work.
I tried to use my phone as router and connect from my phone to react on my notebook and also didn't work.
I've tried so many things since I can't remember them all.
I'm also creating a react-native app and when I try to connect to my mobile using Expo, it just works using tunnel, but cannot get data from the backend.
Please save me.
Thanks
After making many failed attempts, I realized that the problem was in my notebook.
I checked my firewall and it was disabled and still cannot get acess to my notebook on LAN. But finally I discovered what have to be done
Solution
You have to open the specific port for TCP traffic
Ubuntu:
sudo ufw allow <PORT-NUMBER>/tcp
or for Red Hat Enterprise
firewall-cmd --add-port <PORT-NUMER>/tcp
Reference: Examples of how to open firewall ports

Unable to connect to cloud9 over LAN

I've installed cloud 9 Ubuntu 14.04 (Desktop), and executed it by typing:
node [cloud9folder]/server.js -p 8080 -a :
I was able to connect to it by typing localhost:8080 (On the same computer that is running cloud 9) but when I went on another computer on the same network, I was unable to connect by typing [ip address of the computer running cloud9]:8080 into the browser. The browser returned: "Webpage not available (ERR_CONNECTION_REFUSED)."
I know the server computer is working, I was able to access it's apache2 website but for some reason it is unable to connect to cloud 9.
How do I fix this?
also add -l 0.0.0.0 by default server is listening on 127.0.0.1 which is not public

Running protractor tests on IE

I was using vm xp on MAC. MAC and vm are in a network but I'm unable to run protractor tests.
When I run, after pointing Selenium address to vm PC IP in n config file, I can see the IE browser initiating and see the nodejs app URL but I'm unable to access the app.
The nodejs server is running on port 9001 and the app is running on 9009 on my local computer which is a Mac PC.
I can browse the app manually with the IP address 10.0.2.2 on vm but not with protractor config.
I am missing something. Don't I need to open ports on the Mac?
What baseurl in protractor config should I use?
I have pointed selenium address to vm ip address and it is working.
And also the nodejs server is running at 0.0.0.0:9001 port.
The testing story for VM's is a little rough, but there are a few approaches to this:
adding a common hostname (myapp.local) to /etc/hosts (and the windows host file) and using that as the protractor baseUrl
Separating the IE tests from other tests and using the host machine's ip as your baseUrl: baseUrl: 'http://10.0.2.2:9000/'
Alternately, you can use a service like SauceLabs or BrowserStack and run your tests on IE through "the cloud". If you can afford the cost i'd highly recommend them.

Cannot connect to VM VirtualBox Linux Nginx server after restarting my computer

I recently setup an Ubuntu 12.04 LTS server running nginx, and I could connect to it via its IP address. However, after restarting my computer I can no longer connect to the server in any browser but I can connect via SSH through puTTy. No clue what's going on and ifconfig shows that the IP address has not changed and I changed no settings on the server. How can I fix this?
This picture shows the chrome window response when I try to access the server, the ifconfig from the server (top right), the network settings on the VM (bottom left), and the location settings for /etc/nginx/sites-available/www.
server settings
I have tried restarting, doing an nginx reload, and a full computer restart. Nothing has worked so far. All help is greatly appreciated!
First make sure that the service is working using sudo service nginx status
If it's not running try starting it manually sudo service nginx start
If it fails to start, you can check the error log in /var/log/nginx/error.log or any other error log defined in the server config.

Resources