I have a apache2 conf file which should proxy to a internal host. For some reason it works in all situations exception for one. I have a default website setup which acts as a default site. This default site has a dedicated SSL certificate. When the routing goes wrong, I get a security error because the routing to the correct host is incorrect and it falls back to the default host.
This is the configuration I have setup for a virtual host.
<VirtualHost www.example.co.uk:80>
ServerName www.example.co.uk
Redirect permanent / https://example.co.uk/
</VirtualHost>
<VirtualHost example.co.uk:80>
ServerName example.co.uk
Redirect permanent / https://example.co.uk/
</VirtualHost>
<VirtualHost www.example.co.uk:443>
ServerName www.example.co.uk
Redirect permanent / https://example.co.uk/
</VirtualHost>
<VirtualHost example.co.uk:443>
ServerName example.co.uk
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.co.uk/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.co.uk/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.co.uk/fullchain.pem
SSLCACertificateFile /etc/letsencrypt/live/example.co.uk/cert.pem
ProxyPreserveHost On
ProxyPass / http://192.168.122.122:8080/
ProxyPassReverse / http://192.168.122.122:8080/
</VirtualHost>
The routes that work:
The route that doesn't work:
As far as I can see all the routes are correct and should direct as they should. I have also tried the variation of the :443 virtual hosts to not include the "http". Any advice would be appreciated.
EDIT
As per advice, I have modified the www.example.co.uk:443 host to include the same as the SSL using:
<VirtualHost www.example.co.uk:443>
ServerName www.example.co.uk
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.co.uk/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.co.uk/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.co.uk/fullchain.pem
SSLCACertificateFile /etc/letsencrypt/live/example.co.uk/cert.pem
ProxyPreserveHost On
ProxyPass / http://192.168.122.122:8080/
ProxyPassReverse / http://192.168.122.122:8080/
</VirtualHost>
Still no luck