0

I currently have an Ubuntu system running with Apache 2.4.x running with some other Windows servers on a single IP environment. Because of this I currently have configured Apache to handle some domains requests as a reverse proxy (e.g. Exchange).

So far I have managed to get the VirtualHost connecting to the backend systems with the appropriate certificates etc etc. But recently I went to take a look into my connection logs on the Apache machine because I noticed that on my backend website some images weren't loading. My current configuration looks like to be adding the reverse proxy subfolder on every request (see log below).

XXX.XXX.XXX.XXX - - [26/Nov/2013:16:24:13 +0100] "GET /webconsole/assets/script/webConsole.js HTTP/1.1" 302 730

XXX.XXX.XXX.XXX - - [26/Nov/2013:16:24:13 +0100] "GET /webconsole/loginwebconsole/assets/script/webConsole.js HTTP/1.1" 302 762

XXX.XXX.XXX.XXX - - [26/Nov/2013:16:24:13 +0100] "GET /webconsole/loginwebconsole/loginwebconsole/assets/script/webConsole.js HTTP/1.1" 302 794

XXX.XXX.XXX.XXX - - [26/Nov/2013:16:24:13 +0100] "GET /webconsole/loginwebconsole/loginwebconsole/loginwebconsole/assets/script/webConsole.js HTTP/1.1" 302 826

XXX.XXX.XXX.XXX - - [26/Nov/2013:16:24:13 +0100] "GET /webconsole/loginwebconsole/loginwebconsole/loginwebconsole/loginwebconsole/assets/script/webConsole.js HTTP/1.1" 302 858

XXX.XXX.XXX.XXX - - [26/Nov/2013:16:24:13 +0100] "GET /webconsole/loginwebconsole/loginwebconsole/loginwebconsole/loginwebconsole/loginwebconsole/assets/script/webConsole.js HTTP/1.1" 302 890

XXX.XXX.XXX.XXX - - [26/Nov/2013:16:24:13 +0100] "GET /webconsole/loginwebconsole/loginwebconsole/loginwebconsole/loginwebconsole/loginwebconsole/loginwebconsole/assets/script/webConsole.js HTTP/1.1" 302 922

My current httpd.conf

DocumentRoot /var/www/xxxxx.xxxxxx.com
ServerName xxxxx.xxxxxx.com
ProxyPreserveHost On
ProxyVia Full
RequestHeader edit Transfer-Encoding Chunked chunked early
RequestHeader unset Accept-Encoding
ProxyRequests Off
TimeOut 1800

SSLEngine on
SSLProxyEngine On
SSLCertificateFile /var/www/xxxx.xxxxx.xxx/xxxx/xxxxx.crt
SSLCertificateKeyFile /var/www/xxxx.xxxxx.xxx/xxxx/xxxxx.key

Redirect / https:// xxxx.xxxxx.com /webconsole/login (space because topic see as url)

<Location /webconsole/login>
ProxyPass https:// xxxx.xxxxx.com /webconsole/login (space because topic see as url)
ProxyPassReverse https:// xxxx.xxxxx.com /webconsole/login (space because topic see as url)
SSLRequireSSL
</Location>


ErrorLog /var/log/apache2/xxxx_xxxxx_errorlog
CustomLog /var/log/apache2/xxxx_xxxxx_com common

I cant seem to understand why this happens or how to fix this problem.

0

Don't use the Redirect direcive. Just ProxyPass and ProxyPassReverse should be enough.

The following works for me.

    ProxyRequests Off

    ProxyPass /myapp/path http://backend-host:port/myapp/path
    ProxyPassReverse /myapp/path http://backend-host:port/myapp/path

I usually try to keep the exposed absolute path on the proxy the same as the one in the backend server to avoid problems with applications that make explicit redirects.

Edit: This is the complete virtual host configuration on my ubuntu 10.04.

<VirtualHost *:80>

    DocumentRoot /home/b/public_html
    ServerName a.b.com
    ServerAlias a.b.com
    ErrorLog /var/log/apache2/a.b.com-error.log
    CustomLog /var/log/apache2/a.b.com-access.log common

    ProxyRequests Off

    ProxyPass /myapp/path http://backend-host:port/myapp/path
    ProxyPassReverse /myapp/path http://backend-host:port/myapp/path

</VirtualHost>
  • The SSL handshake error you posted is displayed by your browser? Is your browser configured to use a proxy? Is there any additional information in the apache log? Can you try removing the SSL configuration to test the reverse proxy configuration in isolation? – cjungel Nov 27 '13 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy