PodeEndpoint with url reservation
Describe the Feature
I would like to know if it's possible or maybe it could be a nice feature. I would like to register my Pode server with a specific subfolder url. By doing this, We could run more than 1 Pode Server on the same port with different subfolder url.
Example: Pode1: Add-PodeEndpoint -Certificate $cert -Url https://localhost/servicePode1/*
Pode2: Add-PodeEndpoint -Certificate $cert -Url https://localhost/servicePode2/*
https://docs.microsoft.com/en-us/sql/reporting-services/install-windows/about-url-reservations-and-registration-ssrs-configuration-manager?view=sql-server-ver15
Thanks
Hey @phand00,
Looking into it, this is likely something that could work, but it would only work if you're using the HttpListener server in Pode (ie, not: Start-PodeServer -Type Pode) due to URL reservations dependency on HTTP.SYS.
For Pode 2.0, I'm actually looking at moving away from HttpListener - so there's only one web server type in Pode that's truly xplat, and because they're deprecating HttpListener more and more. Meaning this feature would be lost going into 2.0.
I can check to see if this is possible on the Pode server, but without HTTP.SYS there's a chance you'll need a 3rd server running to redirect traffic 🤔
I'll have a look though, if it's possible and quick to add then I might do it for 1.x. 😃
Hey @Badgerati,
moving to xplat wouldn't drop the IIS Support, would it?
@phand00, since you've posted an SSRS Article, you are using IIS in between already, aren't you?
Hi RobinBeismann and Badgerati,
I'm using Pode without IIS. HttpListerner register directly in http.sys. No IIS installed at all.
Hi @RobinBeismann,
The xplat Pode server is what currently makes IIS possible 😄 There won't be any currently functionality lost in dropping HttpListener.
Hi @RobinBeismann,
The xplat Pode server is what currently makes IIS possible There won't be any currently functionality lost in dropping HttpListener.
Thanks for the Info!
Hi RobinBeismann and Badgerati,
I'm using Pode without IIS. HttpListerner register directly in http.sys. No IIS installed at all.
Is there any reason not to install IIS on the Machine and have it handle the URLs for Pode? IIS can also handle the SSL Features using native system certificates for you and utilize SNI along with another (non Pode) applications.
What if I don't want to install IIS or be dependent as I'm running on a Linux machine ? Pode is cross platform at the end.
Ah I see. Sorry, I thought you're on Windows as you've linked a SSRS Article. I didn't realize that SSRS is no longer based on IIS.
Im not the original poster, my comment was an observation,
So the way this was originally suggested isn't possible any more, since Pode moved away from HttpListener; that and it would have been restricted to Windows only due to relying on HTTP.SYS.
I do have an idea that could allow this to work, but it would run from one Pode server - not two, as you'd get socket port conflicts. It should also work cross-platform, and work for the likes of Pode.Kestrel.
My thinking is we add a new -VirtualDirectory to Add-PodeEndpoint. If you then reference this endpoint on Add-PodeRoute using -EndpointName then the route's -Path is automatically prepended with the endpoint's virtual directory. This means you could have all of the routes in a different file and dot-source them in 🤔
ie:
Add-PodeEndpoint -Address localhost -Port 8080 -Protocol Http -VirtualDirectory '/a' -Name Example
Add-PodeRoute -Method Get -Path '/users' -EndpointName Example -ScriptBlock {}
so the route's path is now: /a/users.