Remove splitting of path and path base in Kestrel #1050
Comments
👏 |
Why add |
Map branches, UsePathBase trims (if it matches) and continues. |
So UsePathBase is the same as Map, if you had just taken everything in the Configure and moved it into the config inside the Map? |
The path logic is the same, but for Map the other branch would always be empty and 404. For the urls |
I guess all I was getting at was that it seemed odd to have a new API when you can get the same effect with an existing API.
Wait, so when you said "strip" this is what you mean I guess... meaning if the URL starts with the ~/BaseUrl then it's stripped and then proceeds to the next middleware (so the next MW doesn't see toe original)... Is that what UseUrls used to do? Or am I still confused? Perhaps I guess I need to get the nightlys and test. |
Yes, that's the same as what UseUrls used to do (in Kestrel). |
Ok, I setup a quick test sample on v1.1. In short UseUrls("http://localhost:123/foo") still accepts requests to "http://localhost:123/bar", and that's my confusion. This behavior (that I was previously unaware of) is pretty counter intuitive. Your explanation above now makes more sense, but I am left feeling like I'm missing some major context as to why the counter intuitive behavior existed in the first place. I guess it's a "kestrel thing" (or maybe libuv?), as opposed to how I'd expect http.sys reserved URLs to behave? |
Yes, it was a Kestrel thing. Http.Sys routes requests using scheme, host, port, and path base, but Kestrel really only operates on ip and port. Once it has received a request it doesn't reject it if the host or path base are wrong. |
In 1.1, a path base could be set by appending it to an |
@grantbowering this is only supported via code at the moment. Future improvements are tracked at https://github.com/aspnet/Hosting/issues/1120 |
This is now implemented as the
UsePathBase
Middleware in HttpAbstractions. We can now remove this feature in Kestrel.The text was updated successfully, but these errors were encountered: