0

I have 1 nonSSL server and many SSL with Proxy in Apache.

Configuration SSL server:

<VirtualHost *:443> ServerName test.com ServerAdmin [email protected] ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/... SSLCertificateKeyFile /etc/... SSLCertificateChainFile /etc/... ProxyRequests off SSLProxyEngine on ProxyPass / https://localhost:10000/ ProxyPassReverse / https://localhost:10000/ </VirtualHost> <VirtualHost *:80> ServerName test.com ServerAdmin [email protected] ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined RewriteEngine On RewriteCond %{SERVER_PORT} ^80$ RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [R=301,L] </VirtualHost> 

Configuration nonSSL server:

<VirtualHost *:80> ServerName test.test.com ServerAdmin [email protected] ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined ProxyRequests off ProxyPass / http://localhost:8101/ ProxyPassReverse / http://localhost:8101/ </VirtualHost> 

When I follow to SSL Server - all ok. When I follow nonSSL server Chrome show me SSL server.

What would be problem?

2
  • Do you have HSTS headers active? Commented Dec 3, 2023 at 7:53
  • @GeraldSchneider In Apache - I don't set on this setting, if it not default setting. I see stange behaviour my Firefox either. When I follow http://test.test.com - all ok, to open nonSSL site. But when I do https://test.test.com I see test.com, but https://test.test.com don't have SSL. Why? It's a magic. I don't understand anything. Commented Dec 3, 2023 at 15:52

1 Answer 1

0

As far as I understand with your comment (which could be added to the main question) the expected behaviour is : When you hit https://test.test.com => be redirected to http://test.test.com and don't stay on test.com. It looks like test.com is the defaut and this should be normal when you hit "https://" scheme to go through :443 vhost. If this assumption is right, then you should tell in the https (:443) section : "hey, just go back to http://" like this

 RewriteEngine On RewriteCond %{HTTP_HOST} ^test\.test\.com [NC] RewriteRule ^(.*)$ http://test.test.com/$1 [R=301,L] 
2
  • Yes, it's my default site (first site in confing) - https://test.com. As I undestand you mean if I have only site http://test.test.com and I follow to https://test.test.com then is it normal to show my default site? I expect some error - this's ok behavior for me. Commented Dec 6, 2023 at 0:42
  • Yes the default behaviour is to show something not throwing an error. I mean with your rewrite config you will always be redirected if you try to reach the "http vhost" Commented Dec 20, 2023 at 15:25

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.