4

I have some APIs published in Azure API Management, that call a REST web application behind the scenes. Most of the endpoints use the format:

https://company.azure-api.net/dom/ep/{pathParamVal}?{queryParamName}={queryParamVal}

If {queryParamVal} is a really long string which causes the URL length to exceed 350-400 characters, everything works as expected. But if I specify that same string value as the {pathParamVal}, I get a HTTP 400 error code - HTTP Error 400. The request URL is invalid.. I know this is related to Azure, because the underlying web application works with lengthy path parameters as well as query parameters.

Is there a limitation on how long the URL path can be?

Web User
  • 7,438
  • 14
  • 64
  • 92

1 Answers1

4

Is there a limitation on how long the URL path can be?

Base on my experience, the limition of the WebAPI path is 260 characters that same as the Windows Maximum Path Length Limitation.The Maximum length of URL is limited by the different browsers. More details about the maximum length of a url in different browsers please refer to another SO thread.

Update :

I do a test for it. If the length of pathParamVal >260 then will get the bad request. Or it works correctly. More detail please refer to the screenshots.

  1. If the length of pathParamval >260, then it will get the 400 bad request error.

enter image description here

  1. If the length of pathParamval =260, then it works correctly.

enter image description here

Community
  • 1
  • 1
Tom Sun - MSFT
  • 24,161
  • 3
  • 30
  • 47
  • I am primarily concerned about the path length, because overall lengths can be much higher and still work, if the path parameter value is supplied as a query parameter. – Web User Feb 14 '17 at 23:22
  • I have updated the answer, more details please refer to it – Tom Sun - MSFT Feb 15 '17 at 01:33
  • Is this a default limit that can be increased? – Web User Feb 15 '17 at 01:36
  • Yes, it is the default limitation. unfortunately, we can't find a way to increase it currently. – Tom Sun - MSFT Feb 15 '17 at 01:41
  • Thanks for confirming. – Web User Feb 15 '17 at 02:51
  • Ran into this issue this week. Looks like the path length maximum is now 324 (note we didn't test with a query string, but just the URL). – MisterHux Mar 28 '18 at 16:50
  • Ignore my last comment, can't edit it anymore. Did some more research and came up with this: Ran into this issue this week. Look like this length issue will be there when any one part of the path is longer than 261 characters. Have a URL that accepts zips as part of a path parameter and it fails when longer than 261. – MisterHux Mar 28 '18 at 17:00