Let me clarify the issue. The internal workings of the VM and the webserver arent the issue here as I can pull all that correctly without Zrok.
Also, my host machine is Windows 10. The VM is a virtual box ubuntu 22 (no gui) image orchestrated by vagrant. The VM is addressable via 192.168.101.120
I am running zrok on windows CMD.
I have 2 reserve shares, lets call them.
share1 pointed to local alias: local.api.nexus
share2 pointed to local alias: nexus.integrations.local
The share1 works fine and pulls correctly. share2 through zrok, points to the the local alias that share1 is on.
This is the command I used to make the reserve. Removing actual unique name for a reason.
zrok reserve public --unique-name share2 https://nexus.integrations.local
To Run it:
zrok share reserved --insecure share2
My Host file in Windows:
192.168.101.120 local.api.nexus nexus.integrations.local
Nginx Error Log for calling the zrok share.
2025/03/07 18:42:53 [error] 4823#4823: *61 connect() failed (111: Unknown error) while connecting to upstream, client: 192.168.101.1, server: local.api.nexus, request: "GET /user HTTP/1.1", upstream: "http://127.0.0.1:3000/user", host: "share1.share.zrok.io"
If I call https://nexus.integrations.local/user
I get a response. But if I call share2.share.zrok.io/user
I get 502 bad gateway. Checking the nginx error logs shows the above error where the host: is showing as share1 and not share2.
So in short, zrok is making the call to my VM using the wrong server_name
and thus nginx routes by the server name.