I'm running apache 2.4.29 in ubuntu 18.04 and I have the following setup in 000-default.conf
<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/html
LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error_ssl.log
CustomLog ${APACHE_LOG_DIR}/access_ssl.log combined
SSLEngine on
SSLProxyEngine On
SSLCertificateKeyFile /pathtokey/privkey.pem
SSLCertificateChainFile /pathtokey/chain.pem
SSLCertificateFile /pathtokey/fullchain.pem
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / https://localhost:8443/
ProxyPassReverse / https://localhost:8443/
#ErrorLog ${APACHE_LOG_DIR}/error.log
#CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Apache is working as a proxy to a tomcat server, both with SSL. If I use the url with https, apache works well, but when I try to use http I cannot get redirected to https. I checked and it seems that apache does not listen or handles connections from port 80 (I checked with telnet also)
If I remove SSL settings, and keep one virtualhost in port 80, I can work with no SSL, that works fine in port 80, but when I enabled ssl only I can use the server with https
Is there any way to use http and be redirected to https?