Use relative path in NavigateTo#22146
Conversation
In the code snippet provided as example of doing redirection for user selected culture, there was a NavigateTo with absolute path. This doesn't work if the app is behind a reverse proxy in some virtual subfolder.
|
@beppemarazzi ... Are you setting the app base path in this scenario? If so, then it should form the correct |
|
I think instead of this change that a cross-link here will provide general assistance with in this use case. I'll make an update on this PR to cover it. UPDATE: Done! Let's give this a shot. I'll continue to take feedback on it. 👂 If more devs write in on it, I'll seek to make an additional update and probably write a little text with the link and move the link to a NOTE under the example. Thanks @beppemarazzi! 🚀 |
@guardrex Yes, app base path is correctly set. But with the leading '/' the browser navigates to the absolute path ignoring the base path. |
|
Thanks for that clarification @beppemarazzi. 🤔 ... The API docs seem a bit weak on details. I expected different behavior and guessed wrong that the It doesn't seem like there is any harm in removing the forward slash. I'll put up a PR in a minute to patch that as you originally suggested. I've also made a note on my UE ("User Experience," i.e., total overhaul+updates) tracking issue to take a closer look at this subject when I reach the Host and Deploy overview. I think the docs need a careful assessment on how |
|
Just found this dotnet/aspnetcore#25204... |
In the code snippet provided as example of doing redirection for user selected culture, there was a NavigateTo with absolute path. This doesn't work if the app is behind a reverse proxy in some virtual subfolder.