Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Stop Azure IIS Appending Error Status Code Query String

I have the following setup in my web.config file to handle errors:

<httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="500" />
  <error statusCode="500" responseMode="ExecuteURL" path="/error/internalservererror/" />
</httpErrors>

When I throw an exception in my app it works fine locally but it redirects to the following URL in error-page in azure (note that the page I threw the exception from is at the end of the URL:

https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/about/

How do I stop IIS from exibiting this behaviour in Azure?

like image 709
Muhammad Rehan Saeed Avatar asked Apr 10 '16 07:04

Muhammad Rehan Saeed


1 Answers

Just add a question mark at the end of your path parameter, using your code you would have something like this:

<httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="500" />
  <error statusCode="500" responseMode="ExecuteURL" path="/error/internalservererror/?" />
</httpErrors>
like image 62
Martyn C Avatar answered Sep 30 '22 19:09

Martyn C