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/


Is this possible in apache?

  • 1
    It is not possible at all. You must use different port numbers. – Michael Hampton Jul 11 '18 at 20:28

This is a similar question as this one or this one or this one. It is still not possible to have http and https running on the same port.

  • Thanks bcs78 and @michael-hampton . I knew it's impossible to run both protocols on the same port, but couldn't help but wonder if there was some way to just get the requests to be redirected at least. Anyway, I just changed the current port to a non-ssl port, enabled another custom port for ssl, then redirected the current non-ssl port to the ssl one. – Kishor N Jul 12 '18 at 8:55

Your Answer

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

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