1
0
Fork 0
blog.kempkens.io/_posts/2014-02-17-exchange-reverse-proxy-using-nginx.md
2014-11-30 21:47:18 +01:00

1.7 KiB

layout title description date category tags comments
post Exchange Reverse Proxy Using nginx Simple nginx configuration that allows you to proxy most of Microsoft Exchange. 2014-02-17 21:45:00 CET posts
nginx
exchange
ops
english
true

As it turns out, setting up nginx as a reverse proxy for Microsoft Exchange is not as easy as some posts suggest.

The issue that for some calls (Autodiscovery, RPC, …) IIS asks for an Authorization header, which nginx can pass through by doing:

{% highlight nginx %} proxy_pass_header Authorization; {% endhighlight %}

Only problem is: It doesn't work. Thankfully someone on StackOverflow already had a solution for this:

{% highlight nginx %} proxy_http_version 1.1; proxy_pass_request_headers on; proxy_pass_header Date; proxy_pass_header Server;

proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; more_set_input_headers 'Authorization: $http_authorization'; proxy_set_header Accept-Encoding ""; more_set_headers -s 401 'WWW-Authenticate: Basic realm="your.mail.host"'; proxy_pass https://your.mail.host; {% endhighlight %}

You'll need the HttpHeadersMore module for this to work. On Ubuntu 12.04 (using the nginx/stable PPA) all you need to install is:

{% highlight bash %} apt-get install nginx-extras {% endhighlight %}

And you're good to go!