I just created a new ASP.NET Core Razor Pages project on .NET Core version 3.1, when I run using the Kestrel (console hosting), it opens a Web Browser with URL: https://localhost:5001 - which is OK.
Then when I add "/en/" suffix at the end of the URL and press Enter in the address bar, the page is reloaded but "/en/" is removed from the URL. ('https://localhost:5001/en/' - turns into 'https://localhost:5001' after page reload).
But if I do the same with "/ja/" instead of "/en/" like https://localhost:5001/ja/, the page is reloaded but "/ja/" remains exactly as I want.
What I'm trying to do is to catch "/en/" from the HttpContext.Request.Path - and do some processing from my Middleware.
But since ASP.NET Core keeps removing "/en/" from the URL I can't achieve my goal. I couldn't find any useful information on the Internet about my problem.
You can easily reproduce my problem. Just create a new ASP.NET Core Razor Page project on .NET Core version 3.1. Use Kestrel instead of IIS Express. Append "/en/" at the end of the URL and press ENTER. You'll see that "/en/" is removed. At least this happens on my computer. This problem is true only with "/en/" suffixes. I tried other language codes like "/ja/", "/hk/" - they persist, they are not removed from the URL.