Difficulty in Proxying for MS Exchange Web Access using NGINX

Hi Igor,

Please allow me to thank you for your efforts in coming up and
maintaining such a wonderful piece of software! Its fast, stable and
light on resources … truly an amazing piece of work!

I am running the nginx-0.6.25 software on Ubuntu Server 7.10. I was able
to set up the web services and proxy them to web sites running PHP-based
applications. Finally, I was able to proxy http traffic inside https
using nginx. However, I am having difficulty doing the same for the MS
Web Service for Exchange.

The weird thing is … if I connect to
http://ns1.nexustech.com.ph/exchange/ … everything works! Here are the
pertinent config entries:

server {
    listen          80;
    server_name     ns1.nexustech.com.ph;
    access_log      /var/log/nginx/access_http.log main;
    location / {
       proxy_pass   http://192.168.0.135;
       proxy_set_header     Host            $http_host;
    }
}

But if I were to connect using https://ns1.nexustech.com.ph/exchange/
… I get the connected and everything but some functions do not work
properly … in fact, what seems to happen is that it tries to keep
connecting back to the http port … I have tried enabling
proxy_redirect but I can’t seem to get the right redirection …

Anyway, here is the https section:

server {
    listen       443;
    server_name  ns1.nexustech.com.ph;
    access_log  /var/log/nginx/access_https.log  main;

    ssl                  on;
    ssl_certificate      /etc/ssl/certs/cert.crt;
    ssl_certificate_key  /etc/ssl/private/cert.key;

    location / {
        proxy_pass          http://192.168.0.135;
        proxy_set_header    Host               $http_host;
    }

And here are some log entries from the access_https.log:

202.175.215.131 - - [02/Feb/2008:22:52:17 +0800] GET /exchange? HTTP/1.1
“401” 83 “-” “RPT-HTTPClient/0.3-3E” “-”
202.175.215.131 - - [02/Feb/2008:22:52:17 +0800] GET /exchange? HTTP/1.1
“401” 83 “-” “RPT-HTTPClient/0.3-3E” “-”

And from the access_http.log:

124.6.189.254 - mario [02/Feb/2008:23:08:02 +0800] POST
/exchange/mfarroyo/Drafts/Difficulty%20in%20Proxying%20for%20MS%20Exchange%20Web%20Access%20using%20NGINX.EML
HTTP/1.1 “302” 0
http://ns1.nexustech.com.ph/exchange/mfarroyo/Drafts/Difficulty%20in%20Proxying%20for%20MS%20Exchange%20Web%20Access%20using%20NGINX.EML?Cmd=edit
“Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.11) Gecko/20071204
Ubuntu/7.10 (gutsy) Firefox/2.0.0.11” “-”
124.6.189.254 - mario [02/Feb/2008:23:08:03 +0800] GET
/exchange/mfarroyo/Drafts/Difficulty%20in%20Proxying%20for%20MS%20Exchange%20Web%20Access%20using%20NGINX.EML?Cmd=edit
HTTP/1.1 “200” 3212
http://ns1.nexustech.com.ph/exchange/mfarroyo/Drafts/Difficulty%20in%20Proxying%20for%20MS%20Exchange%20Web%20Access%20using%20NGINX.EML?Cmd=edit
“Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.11) Gecko/20071204
Ubuntu/7.10 (gutsy) Firefox/2.0.0.11” “-”
/var/log/nginx/access_http.log (END)

Thanks in advance for your help!

Mario