Run MS Exchange through Apache

Print

Q. I don't want to expose my windows machine to the world and much rather run Outlook Web Access (OWA) through an Apache Rewrite/ProxyPass - how can I do that?

A. We haven't tested MS Exchange 2007, but it worked with 2003. It is not something that is highly recommended, but it has its advantages. First of all, you are right - the windows system is blocked and only exchange web is accessible. Second, you have 2 servers - Linux and Windows. With ProxyPass, you can host windows applications (ie. .Net, mssql, etc.) and with direct access - you have Apache, MySQL, PHP, python, perl, etc.

This is how we did it. (The system used for that was Fedora 11, but it should work on any modern Linux distribution)

<VirtualHost *:80>
DocumentRoot /www/docs/exchange
ServerName mail.example.com
ServerAlias www.mail.example.com

SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1

ProxyPreserveHost On

#OWA % character in email subject fix
RewriteEngine On
RewriteMap percentsubject int:escape
RewriteCond ^/exchange/.*\%.*$
RewriteRule (/exchange/.*) ${percentsubject:} [P]                      

ProxyPass /rpc https://192.168.1.10/rpc/
ProxyPassReverse /rpc https://192.168.1.10/rpc/
ProxyPass /exchange https://192.168.1.10/exchange/
ProxyPassReverse /exchange https://192.168.1.10/exchange/
ProxyPass /exchweb https://192.168.1.10/exchweb/
ProxyPassReverse /exchweb https://192.168.1.10/exchweb/
ProxyPass /public https://192.168.1.10/public/
ProxyPassReverse /public https://192.168.1.10/public/
ProxyPass /iisadmpwd https://192.168.1.10/iisadmpwd/
ProxyPassReverse /iisadmpwd https://192.168.1.10/iisadmpwd/
ProxyPass /exchange-oma https://192.168.1.10/exchange-oma/
ProxyPassReverse /exchange-oma https://192.168.1.10/exchange-oma/
ProxyPass /Microsoft-Server-ActiveSync https://192.168.1.10/Microsoft-Server-ActiveSync/
ProxyPassReverse /Microsoft-Server-ActiveSync https://192.168.1.10/Microsoft-Server-ActiveSync/

CacheDisable *

</VirtualHost>

You should be able to just copy paste this code, replace mail.example.com with whatever your domain is, replace IP and restart Apache.

We've got a few errors in the logs:

proxy: Max-Forwards has reached zero - proxy loop? returned by

Most of them was from Spam with funny characters in the subject, so ignored those. The emails that returned this error eventually opened.

Windows