I have a odoo instance running in an ubuntu16 server. Apache is acting as the front end server and is proxypassing the request to the odoo instance. I have now configured the virtualhost to enable SSL on the frontend URL, which works for the URLs : https://example.com:8069 and https://www.example.com:8069
What I need to achieve is, when someone access the URLs http://example.com:8069 and http://www.example.com:8069 they should be redirected to https://example.com:8069
I cannot use .htaccess methods, since the application doesn't have it. Also, the redirect parameter cannot be passed in the vhost of non-ssl port, because there is no non-ssl port (only this ssl port is enabled for the application, and default ports are already allocated for other websites.) The virtualhost entries are:
<IfModule mod_ssl.c>
<VirtualHost *:8069>
ServerName example.com:8069
ServerAlias www.example.com:8069
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
SSLEngine on
SSLCertificateKeyFile /etc/apache2/sslsrp.com/example.key
SSLCertificateFile /etc/apache2/sslsrp.com/example.crt
SSLCertificateChainFile /etc/apache2/sslsrp.com/example.txt
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /longpolling/ http://localhost:8072/
ProxyPassReverse /longpolling/ http://localhost:8072/
ProxyPass / http://localhost:9069/
ProxyPassReverse / http://example.com:8069/
</VirtualHost>
</IfModule>
Is this possible in apache?