Can not Forwarding from www to non-www version while using SSL with modcluster
sunchanras Nov 24, 2016 4:54 AMI configured httpd with modcluster and I want to redirect www to non-www version while using SSL but it did not work.
Here is the configuration for modcluster and a virtual host listen on port 80 to forward from http to https:
<IfModule manager_module>
Listen 192.168.123.9:6666
ManagerBalancerName wfycluster
<VirtualHost 192.168.123.9:6666>
AllowDisplay On
ServerAdvertise On
KeepAliveTimeout 300
MaxKeepAliveRequests 0
AdvertiseFrequency 5
ServerAdvertise On 192.168.123.9:6666
AdvertiseGroup 224.0.1.105:23364
EnableMCPMReceive On
ProxyPassMatch ^/sas/ !
ProxyPass / balancer://wfycluster stickysession=JSESSIONID|jsessionid nofailover=on
ProxyPassReverse / balancer://wyfcluster
ProxyPreserveHost on
<Location />
Require all granted
</Location>
<Location /wfycluster>
SetHandler mod_cluster-manager
Require all granted
</Location>
</VirtualHost>
</IfModule>
<VirtualHost *:80>
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</VirtualHost>
Here is the configuration for SSL virtual-host:
Listen 443 https
SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog
SSLSessionCache shmcb:/run/httpd/sslcache(512000)
SSLSessionCacheTimeout 300
SSLCryptoDevice builtin
<VirtualHost _default_:443>
#DocumentRoot "/var/www/html"
ServerName qoosi.com:443
ServerAlias wwww.qoosi.com:443
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{ENV:HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301,NE]
ProxyPassMatch ^/sas/ !
ProxyPass / balancer://wfycluster stickysession=JSESSIONID|jsessionid nofailover=on
ProxyPassReverse / balancer://wyfcluster
ProxyPreserveHost on
#static asset
alias /sas /var/www/html/sas
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5:!SEED:!IDEA
SSLCertificateFile /etc/httpd/ssl/qoosi_com.crt
SSLCertificateKeyFile /etc/httpd/ssl/qoosi_com.key
#SSLCertificateChainFile /etc/pki/tls/certs/server-chain.crt
SSLCACertificateFile /etc/httpd/ssl/qoosi_com.ca-bundle
#SSLVerifyClient require
#SSLVerifyDepth 10
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
</VirtualHost>