I have hosted a front end app using React and React Router Dom to Azure.
I have a reset password link with token as below
This work fine with localhost. However in Azure it gives this error
"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
I have already added the web.config that was suggested in few posts. It works for shorter URL but not sure how to make it work for bigger urls with tokens.
<?xml version="1.0"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
<httpRuntime maxQueryStringLength = "10000" />
</system.web>
<system.webServer>
<rewrite>
<rules>
<rule name="React Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
<security>
<requestFiltering>
<requestLimits maxQueryString="10000" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
2
Answers
SOLVED: Please use below. It seems this was a bug and they fixed it in 2019 github.com/Azure/azure-functions-host/pull/3916
Azure has a
default limit of 2048 characters
for URLs. You can increase the limit by adding the following configuration to yourweb.config
file.As per the
Azure Web App URL Length Limitations.
The increase in the maximum length of the query string to 32768 characters.
And you need to adjust the
maxQueryStringLength
value in thehttpRuntime
element to match the new limit you set in therequestLimits
element.Approach 2
And it is a good practice to ensure that the URL is properly formatted and can be parsed correctly by the server.
Alternatively, you can try shortening the token by using a tokenization service or by generating a shorter token.
Another option is
storing the token in a database
and passing aunique identifier in the URL
instead of the entire token.For further information refer to the SO link.