Articles

Running Apache behind an IIS server. .Net Solution

Yesterday I had the challenge to redirect – rewrite an url from my public IIS7 server to an internal Apache server. For instance a request to http://www.mysite.com/app handled by IIS should be redirected (using a reverse proxy) to  http://127.0.0.1:8080/app where the internal Apache is listening.

Trying to configure it with the new Application Request Routing (ARR) module from Microsoft was a disappointing task. Once installed, my server stopped serving pages, and I could not find a way to make it work.

So I started googling for another solution, finding out that most of the internet articles tell you that is almost impossible to do the work the way  I wanted, recommending to use Apache as your public server and then redirect – rewrite requests to an internal IIS server.

Finally I crossed my eyes over a page that talked about Managed Fusion URL Rewriter that was exactly what I was looking for: a simple, fast and easy to configure solution.

Managed Fusion URL Rewriter is a really small ASP.NET assembly based on Apache mod_rewrite which provides nice url rewrite and reverse proxy capabilities.

So to solve my issue I created an ASP.Net application to handle requests for http://www.mysite.com/app on my IIS server, following the examples provided with Managed Fusion URL Rewriter download,  and changing the provided ManagedFusion.Rewriter.txt configuration file to:

RewriteEngine On
#RewriteLog c:\log.txt 
#RewriteLogLevel 9

RewriteBase /app
RewriteRule ^(.*)$    http://127.0.0.1:8080/app$1 [QSA, P]

The configuration simply tells to the Managed Fusion URL Rewriter that any call to /app should be redirected to the internal Apache server.

Hope it helps!!!

  1. HemantHemant10-17-2011

    Dear
    I have the same requirement but in my case Apache Server is on different Internal IP and also i am using IIS6 and its not possible for me to migrate IIS6 -> IIS7.And this Apache server is my intranet base application server.

    waiting for the reply
    Thanks
    Hemant

    • Carlos MendibleCarlos Mendible10-17-2011

      Hi,

      in this case you can use Managed Fusion URL Rewriter ( http://managedfusion.com/products/url-rewriter/) they provide a sample web.config for II6.

      Once you get the correct config file, you´ll just have to copy my ManagedFusion.Rewriter.txt and replace any reference to 127.0.0.1:8080 with the IP and port of your intranet application.

      Hope it helps!

Leave a Reply

Rss Feed Tweeter button Facebook button Linkedin button