Azure is decoding characters in the URL before reaching the application

Jkuhl 40 Reputation points
2023-01-12T17:17:38.88+00:00

In our backend API, we have an endpoint with a path variable and we need to be able to support certain special characters. To accomplish this, we are encoding the path variable with UTF-8 before hitting the endpoint. This works for most special characters, but the problem we are facing is that Azure is decoding some of the encoded characters before the application receives the request.

Use this endpoint as an example: GET: /example/{pathParam}/test

Say I need to provide "TEST/1" as the input. First I would encode the special character and hit the endpoint with this url: GET: /example/TEST%2F1.

This works fine when I am running the application locally, but when I hit the apps deployed on Azure, I receive a 404 not found error for path /example/TEST/1. Does anyone know if there is a way to prevent Azure from decoding characters in the URL before it sends the request to the application?

Developer technologies | ASP.NET | ASP.NET Core
Developer technologies | ASP.NET | ASP.NET API
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
{count} votes

1 answer

Sort by: Most helpful
  1. hossein jalilian 13,285 Reputation points Volunteer Moderator
    2024-02-02T21:45:51.8966667+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    Yes, this was a bug reported under issue number 9290 and was addressed in a fix that was implemented on October 12, 2023. You can find more details about the bug fix in the following GitHub pull request: https://github.com/Azure/azure-functions-host/pull/9402. Your issue should now be resolved.

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.