500.50 error using URL Rewrite

I ran into a 500.50 error yesterday, which wasn’t very descriptive initially, so I thought I would provide some details on what it could be.

First, off, if you hit the page remotely, it’s going to hide the real details.  It will look something like this:

Server Error

500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed.

Checking the IIS logs will show that it’s a 500.50 error in this case.

The first thing to do after running into a general error like this is to test it locally on the server.  Now you get a lot more information (I’ve included just some of the error details below):

HTTP Error 500.50 - URL Rewrite Module Error.

The server variable "HTTP_HOST" is not allowed to be set. Add the server variable name to the allowed server variable list.
Detailed Error Information
Module RewriteModule
Notification BeginRequest
Handler StaticFile
Error Code 0x80070005

Now we can tell exactly what happened.  I’m using URL Rewrite 2.0.  Version 2 now allows updating Server Variables.  I tried to update the HTTP_HOST server variable at the site level but forgot to add HTTP_HOST as an approved server variable.

To fix this issue, go to View Server Variables in the Actions pane of URL Rewrite.  Note that you will only see these if you are an administrator on the server.

image

Now add the server variable that you want to change at the site level:

image

That resolved my situation.  However, a 500.50 error can be used for a number of things, always URL Rewrite related. 

Here’s the official description of a 500.50 error:

500.50 - A rewrite error occurred during RQ_BEGIN_REQUEST notification handling. A configuration or inbound rule execution error occurred.

500.51, 500.52 and 500.53 are also URL Rewrite Related: http://support.microsoft.com/kb/943891

Here are a couple other posts of 500.50 situations:

http://forums.iis.net/t/1164360.aspx
http://www.digitalpimple.com/tutorials/windows-tutorials/fix-550-rewrite-error/ (I believe the author meant 500.50)

Hope that helps someone, and happy URL Rewriting!

3 Comments

Comments have been disabled for this content.