WSL and devcert react page problem with local SSL

huangapple go评论69阅读模式
英文:

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 &lt; 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&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  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系统上获取该地址:

&gt; wsl hostname -I
英文:

I have resolved this by obtaining the IP address of the WSL2 system by running

$ ifconfig
eth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  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

&gt; wsl hostname -I

huangapple
  • 本文由 发表于 2023年5月10日 18:51:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76217528.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定