Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an Apache 2.4 server on Windows 2008 that has been working great as a reverse proxy. It is serving content from a LifeRay 6.0 installation running on Glassfish 3.0. Originally, when we implemented an https permanent redirect we could no longer log into LifeRay but that has been solved, I think, at this point. Once we log into Liferay, the connection is secure, but it is still possible to change the https to http and the page will display as an http connection without reverting back to https. Also, the initial connection to the site can use http and the if the user doesn't log in, the site will continue to use an http connection. Again, I though the redirect permanent would force all http traffic to be https.

Apache is providing the SSL connection to users and the proxypass directives connect to LifeRay on an insecure port, which isn't an issue because the internal connection is virtual and not accessible from the Internet. So, I though I had the configuration nailed down on this but I must be missing something because I seem to be able to access the site with http when I thought the permanent redirect would prevent that. Should ProxyPassReverse be https rather than http? Here is the configuration:

TEST SERVER
<VirtualHost *:443>
ServerName test.myexternalserver.org
 #
 ProxyPreserveHost On
 SetEnv proxy-sendchunked
 SSLEngine on
 ProxyPass / http://192.168.80.196:8080/
 ProxyPassReverse / http://192.168.80.196:8080/

 </VirtualHost>

 <VirtualHost *:80>
 ServerName test.myexternalserver.org
 ProxyPreserveHost On
 SetEnv proxy-sendchunked
 Redirect permanent / https://test.myexternalserver.org/
 ProxyPass / http://192.168.80.196:8080/
 ProxyPassReverse / http://192.168.80.196:8080/

 </VirtualHost>
share|improve this question
    
Just to verify, can you provide the output from apachectl -S? Is there any particular reason you have the ProxyPass configured in the port 80 listener, when you only want application traffic to be handled via port 443? –  Shane Madden May 9 '13 at 3:58
    
The 80 listener was there because we had an issue where we couldn't log into Liferay using SSL. After I fixed that issue, I just never removed it and assumed that the Redirect permanent would ensure that the 80 traffic would be redirected to 443. I guess I could try removing that entry on our test server and see what happens. (BTW it look like apachectl isn't a supported command on Windows) –  Pete Helgren May 10 '13 at 10:51

1 Answer 1

up vote 0 down vote accepted

From what I've read this morning, the modules are executed in a set order. (The order seems to be determined by the module's code at compile-time.) Based on your question here, it sounds like mod_proxy (for ProxyPass & co.) is executed before mod_alias (for Redirect).

To get the expected behaviour, you can remove all the references to the proxy from your port-80 virtual host. We have may VHosts that look very much like this in production, and they work just fine.

<VirtualHost *:80>
  ServerName test.myexternalserver.org
  Redirect permanent / https://test.myexternalserver.org/
</VirtualHost>
share|improve this answer
    
This is a pretty old post and sorry I didn't flag it sooner. This is eventually what I did a few months ago after cleaning up some other spurious entries. Just redirect to https ... –  Pete Helgren Feb 20 at 22:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.