This is probably something I have done. I have setup a local instance of zrok and it seems to work fine. However I seem to have issues when accessing more complex web services. In my test cases, I have one person who uses Laravel on their mac. And they use Laravel Valet to serve their pages. I believe this is behind NGINX. In this case, it worked fine locally, but when trying to serve the page through zrok, it returns a 404.
Another example, I have CUPS running locally on my mac. It is access via http://localhost:631. When I share this with ZROK I just see "Bad Request". using the randomized link. Looking at the CUPS log I see:
[08/Jul/2024:11:50:48 -0400] [Client 2062] Request from "localhost" using invalid Host: field "l0f6zodvldyp.zrok.domain.com".
So it seems like ZROK isnt sending the endpoint host header? Is there a way for ZROK to access the local resource using the local resource hostname in the host header?
Hi @icsy7867, welcome to the community and to zrok (and OpenZiti)!
I don't think zrok would be able to ever actually support adding that host header on it's own if you are using a single share to access two different services expecting a Host header... It sounds to me like that's the situation? You have two different services behind ONE zrok share? Could you zrok share twice and using the expected hostname for each share? I'm not sure if that would work either tbh, I sort of think it wouldn't, but in a 1:1 share situation, it's conceivable that a feature request to zrok would make sense where you could ask for one or more HTTP headers to be added in that sort of situation.
Alternatively, if you have access to "code" on the client side, you could set the desired host header there and zrok will happily send that along. I tried to lookup CUPS but I don't know what that is and it wasn't an easy thing to find on the internet due to the common name it has...
But that is only for the frontend correct? So if I am in chrome, and I type: https://l0f6zodvldyp.zrok.domain.com into my browser, this will hit Caddy, and then redirect to the ZROK frontend, and preserves: https://l0f6zodvldyp.zrok.domain.com/ in the host header as Caddy sends the incoming request to the zrok frontend. I dont think that would preserve my "localhost" once it hits the zrok client running on my mac?
Or am I thinking about the Caddy Proxy additional container here: https://docs.zrok.io/docs/guides/self-hosting/docker/
Which would be considered a frontend? And there this is another caddy backend I should look at?
No. Caddy is used in the Docker configuration primarily as a mechanism to manage TLS.
I'm describing the --backend-mode caddy backend for zrok share. It's there to allow you to aggregate multiple endpoints into a single HTTP share, and do header rewriting and such.
There aren't currently good docs for it. You might just want to give the YouTube video listed above a quick watch, and check out the example configurations:
That's amazing to hear, sounds very neat! If you end up blogging about it or posting something on social media let us know so we can get the official OpenZiti account to repost etc
We really do appreciate you taking the time to give us the good news though, thanks for sharing!