0

Setup:

-Asp.net MVC website (siteA) with application_error handler implemented in global.ascx and only one Rule in the web.config (the reverse proxy rewrite rule).

-IIS reverse proxy setup with /subdirectory of siteA pointing to siteB domain.

-IIS rewrite module has been moved to the top of IIS modules list for siteA.

Problem:

The reverse proxy configuration works on a testsiteA that has nothing in it the IIS folder except the iis rewrite rule in the web.config. No other folders, files, etc. This testsiteA works fine in that the rewrite rule works as imtended. However, when I apply the same rule to the real site, siteA, that has an asp.net MVC website Hosted the rewrite rule is never processed. Instead, the application_error handler is reached in the global.ascx and processing of the URL rewrite rule is not processed. I've tried to do Response.End(), clearing server errors, basic 'return;' statement to end execution, all in the application_error handler but none have worked.

How do I get IIS or the asp.net pipeline to process the URL rewrite as top priority?

1 Answer 1

0

After adding some logging (I couldn't get the error handler to invoke in debug mode), I found our controller IoC couldn't resolve the subdirectory path (I also removed it from disk where it had been). To resolve this and let the URL rewrite be processed I simply added a

routes.IgnoreRoute("subdirectory/{}pathInfo}");

to the RouteConfig.cs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.