Forum Moderators: phranque

Message Too Old, No Replies

Reverse proxy redirecting fails for MS Exchange server ActiveSync service

         

Kristofferson

12:21 pm on Jun 26, 2012 (gmt 0)

10+ Year Member



Hi All!

I'm trying myself with reverse proxy under the Apache 2.2.15 with ssl enabled.
It's the proxy for MS Exchange server (the problem is with ActiveSync service) and in most of cases it works correctly. However from time to time I get Bad gateway error... I cannot find the reason - not sure is it fault of mod_ssl, or proxy configuration, so I'm stopped in this point and can't move.

My virtual host confiuration looks like this

<VirtualHost *:443>

RequestHeader set Front-End-Https "On"
ServerName server.com

SSLEngine on
SSLProxyEngine On
SSLCertificateFile /etc/httpd/conf/certs/server.crt
SSLCertificateKeyFile /etc/httpd/conf/certs/server.key

ProxyPass /Microsoft-Server-ActiveSync https://192.168.2.50/Microsoft-Server-ActiveSync/
ProxyPassReverse /Microsoft-Server-ActiveSync https://192.168.2.50/Microsoft-Server-ActiveSync/

</VirtualHost>


and when the Bad gateway occurs I have the following errors in error_log of Apache

[Tue Jun 26 12:08:41 2012] [info] Initial (No.1) HTTPS request received for child 5 (server server.com:443)
[Tue Jun 26 12:08:41 2012] [debug] mod_proxy_http.c(56): proxy: HTTP: canonicalising URL //192.168.2.50/Microsoft-Server-ActiveSync/
[Tue Jun 26 12:08:41 2012] [debug] proxy_util.c(1506): [client 207.46.14.52] proxy: https: found worker https://192.168.2.50/Microsoft-Server-ActiveSync for https://192.168.2.50/Microsoft-Server-ActiveSync/
[Tue Jun 26 12:08:41 2012] [debug] mod_proxy.c(998): Running scheme https handler (attempt 0)
[Tue Jun 26 12:08:41 2012] [debug] mod_proxy_http.c(1962): proxy: HTTP: serving URL https://192.168.2.50/Microsoft-Server-ActiveSync/
[Tue Jun 26 12:08:41 2012] [debug] proxy_util.c(2011): proxy: HTTPS: has acquired connection for (192.168.2.50)
[Tue Jun 26 12:08:41 2012] [debug] ssl_engine_io.c(1925): OpenSSL: I/O error, 5 bytes expected to read on BIO#7f02494d9350 [mem: 7f02495051d3]
[Tue Jun 26 12:08:41 2012] [debug] proxy_util.c(2067): proxy: connecting https://192.168.2.50/Microsoft-Server-ActiveSync/ to 192.168.2.50:443
[Tue Jun 26 12:08:41 2012] [debug] proxy_util.c(2193): proxy: connected /Microsoft-Server-ActiveSync/ to 192.168.2.50:443
[Tue Jun 26 12:08:41 2012] [debug] ssl_engine_io.c(1925): OpenSSL: I/O error, 5 bytes expected to read on BIO#7f02494d9350 [mem: 7f02495051d3]
[Tue Jun 26 12:08:41 2012] [info] [client 192.168.2.50] (104)Connection reset by peer: SSL input filter read failed.
[Tue Jun 26 12:08:41 2012] [error] [client 207.46.14.52] (104)Connection reset by peer: proxy: error reading status line from remote server 192.168.2.50
[Tue Jun 26 12:08:41 2012] [debug] mod_proxy_http.c(1456): [client 207.46.14.52] proxy: NOT Closing connection to client although reading from backend server 192.168.2.50 failed.
[Tue Jun 26 12:08:41 2012] [error] [client 207.46.14.52] proxy: Error reading from remote server returned by /Microsoft-Server-ActiveSync/
[Tue Jun 26 12:08:41 2012] [debug] proxy_util.c(2029): proxy: HTTPS: has released connection for (192.168.2.50)
[Tue Jun 26 12:08:41 2012] [debug] ssl_engine_kernel.c(1886): OpenSSL: Write: SSL negotiation finished successfully
[Tue Jun 26 12:08:41 2012] [info] [client 207.46.14.52] Connection closed to child 5 with standard shutdown (server server.com:443)


Well, I've tried many different configurations (also have to redirect the http to https, but first I need to resolve that issue) without any effort. It's my first time when trying to configure the Apache reverse proxy and Exchange so I have no idea where could I look for help. Exchange configuration is ok - without proxy works perfect, so I've probably messed up around the Apache config...
Is there anyone who can take a look on this problem? Any hints are very welcome :)

Kristofferson

9:29 am on Jun 28, 2012 (gmt 0)

10+ Year Member



Ok, let me talk to myself...
The problem turns out to be very easy to solve. I've used RevriteRule against the ProxyPassReverse, and works like a charm :)
If someone will face simillar problem, just use
RewriteRule ^/(.*) https://internal.server.address/$1 [P]


Maybe I cannot ask questions but it seems I can give an answers :)

incrediBILL

3:49 am on Jul 8, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks for the information and welcome to WebmasterWorld.

Hopefully next time you'll have a slightly easier question we can answer for you ;)