英文:
WSL and devcert react page problem with local SSL
问题
I got a react service project that due to a specific setup it runs on port 443 on development mode. It uses a dev-proxy that connects the local instance to a staging istance. The usual way of connecting is using devcert to create self signed certificates against a manually entered CA in the system, then modifying the hosts
file with an entry such like this:
127.0.0.1 app.mycompany.local
Normally this allows developers to connect to their local instance and resolve the microfrontends to the staging environment.
Me, being the stubborn person that I am, use Windows with WSL. It has worked absolutely perfectly for years until this situation.
When I run the project on WSL, the server spins up fine, but when I try to access the website at https://app.mycompany.local/a-page
I get a ERR_CONNECTION_REFUSED
error on the browser. This is even more curious when I run a curl --verbose https://app.mycompany.local/a-page
in the WSL console and I get a < HTTP/1.1 200 OK
with the content of the page.
Anyone know how to deal with this situation?
英文:
I got a react service project that due to a specific setup it runs on port 443 on development mode. It uses a dev-proxy that connects the local instance to a staging istance. The usual way of connecting is using devcert to create self signed certificates against a manually entered CA in the system, then modifying the hosts
file with an entry such like this:
127.0.0.1 app.mycompany.local
Normally this allows developers to connect to their local instance and resolve the microfrontends to the staging environment.
Me, being the stubborn person that I am, use Windows with WSL. It has worked absolutely perfectly for years until this situation.
When I run the project on WSL, the server spins up fine, but when I try to access the website at https://app.mycompany.local/a-page
I get a ERR_CONNECTION_REFUSED
error on the browser. This is even more curious when I run a curl --verbose https://app.mycompany.local/a-page
in the WSL console and I get a < HTTP/1.1 200 OK
with the content of the page.
Anyone know how to deal with this situation?
答案1
得分: 0
我已解决此问题,通过运行以下命令获取WSL2系统的IP地址:
$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1492
inet {WSL2_IP_ADDRESS} netmask 255.255.240.0 broadcast 172.20.111.255
然后将WSL2_IP_ADDRESS
添加到我的 hosts 文件中,而不是127.0.0.1
。
也可以通过运行以下命令在主机的Windows系统上获取该地址:
> wsl hostname -I
英文:
I have resolved this by obtaining the IP address of the WSL2 system by running
$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1492
inet {WSL2_IP_ADDRESS} netmask 255.255.240.0 broadcast 172.20.111.255
and entering WSL2_IP_ADDRESS
in my hosts file instead of 127.0.0.1
.
The address can also be obtained from the host Windows system by running
> wsl hostname -I
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论