Bad Request - Invalid Hostname

Hello everyone, I need help, this is the first time I use zrok. I have a .NET project (.NET Framework, not NET Core) and I am using zrok to run my project with public IP, but when I try to access my project with generated ip, an error occurs:

Bad Request - Invalid Hostname

HTTP Error 400. The request hostname is invalid.

What can it be?

Hi @01Dri, welcome to the community and to zrok! (and OpenZiti)

I am relatively certain this will end up being a problem where your .NET app is expecting a certain host header to be presented to the app in order to route properly and that host header is now "12345example.share.zrok.io" (or whatever your share is).

I'll try to work up an IWR (invoke-web-request) command to help you prove the hypothesis. Can you share the url you usually access the app at? If not, I'll just use a placeholder type thing.

For example, i just shared a website using: zrok share public localhost:3000. That produced this url: https://4dnqkg5y07qb.share.zrok.io

If you use IWR on that site it'll work fine (the a.txt file has the content of "hi"):

Invoke-WebRequest https://4dnqkg5y07qb.share.zrok.io/a.txt | Select-Object -ExpandProperty Content
hi

But if i override the host header, it'll stop working because zrok uses that header to locate the service:

Invoke-WebRequest -Headers @{"Host"="wrong.host.here"} https://4dnqkg5y07qb.share.zrok.io/a.txt
Invoke-WebRequest: The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

The same sort of thing is probably happening for you. Try the IWR request but put your URl where i have "wrong.url.here" and use your zrok share url.

If that works, that's the issue