Search code examples
apache2apache-config

Apache-2 proxypass exclusion with SSL


I use Jboss +Apache solution. [Please see my httpd-vhost.conf file below]

I tried to exclude my images folder from proxy redirection.

What I try to do is, pick images from /usr/local/images/ alias when I use http://www.mysite.com/images and https://www.mysite.com/images links.

This is working fine with virtual host port 80 but when I do same configurations on virtual host port 443 it’s not picking up images from /usr/local/images/ alias and redirect to Jboss.

In other words http://www.mysite.com/images link is working but https://www.mysite.com/images is not working with same configurations.

Also please note that rest of SSL configurations are working fine. I can access https://www.mysite.com without any issue.

Can anyone please help on this?

<VirtualHost www.mysite.com:80>
ServerName www.mysite.com
ProxyPreserveHost On
ProxyPass /images !
Alias /images/ /usr/local/images/
ProxyPass / http://www.mysite.com:8080/
ProxyPassReverse / http://www.mysite.com:8080/
</VirtualHost>


<VirtualHost www.mysite.com:443>
ServerName www.mysite.com
SSLEngine On
SSLCertificateFile "\jboss-5.1.0.GA\server\default\conf\mysite.crt"
SSLCertificateKeyFile "\jboss-5.1.0.GA\server\default\conf\mysite.key.insecure"
ProxyPreserveHost On
ProxyPass /images !
Alias /images/ /usr/local/images/
ProxyPass / http://www.mysite.com:8080/
ProxyPassReverse / http://www.mysite.com:8080/
</VirtualHost>

<Directory /usr/local/images/>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
</Directory>

Solution

  • I found a solution.

    What I have done is create separate httpd-ssl.conf file and Listen 443. Other configurations are same.

    Please see my httpd-ssl.conf file below.

    Thanks

    Listen 443
    
    <VirtualHost www.mysite.com:443>
     ServerName www.mysite.com
     SSLEngine On
     SSLCertificateFile "\jboss-5.1.0.GA\server\default\conf\mysite.crt"
     SSLCertificateKeyFile "\jboss-5.1.0.GA\server\default\conf\mysite.key.insecure"
     SSLProxyEngine On
     ProxyRequests Off
     ProxyPreserveHost On
     ProxyPass /images !
     Alias /images/ /usr/local/images/
     ProxyPass / https://www.mysite.com:7443/
     ProxyPassReverse / https://www.mysite.com:7443/
    </VirtualHost>