Score:0

Apache HTTP virtualhost always redirects to HTTPS default virtual host

kg flag

In my Apache 2.4.41 HTTP server I have some HTTPS virtualhosts, and an HTTP-only one. I noticed that this HTTP virtualhost is not reachable, because users are always redirected to the default HTTPS virtualhost: when an user wants to visit http://water.sitename.com he gets redirected to https://app.sitename.com

I used apache2ctl -S command and virtualhosts look correctly configured to me:

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server app.sitename.com (/etc/apache2/sites-enabled/app.sitename.com.conf:1)
         port 80 namevhost app.sitename.com (/etc/apache2/sites-enabled/app.sitename.com.conf:1)
         port 80 namevhost ticket.sitename.com (/etc/apache2/sites-enabled/ticket.sitename.com.conf:1)
         port 80 namevhost water.sitename.com (/etc/apache2/sites-enabled/water.sitename.com.conf:1)
         port 80 namevhost www.sitename.com (/etc/apache2/sites-enabled/www.sitename.com.conf:2)
*:443                  is a NameVirtualHost
         default server app.sitename.com (/etc/apache2/sites-enabled/app.sitename.com.conf:15)
         port 443 namevhost app.sitename.com (/etc/apache2/sites-enabled/app.sitename.com.conf:15)
         port 443 namevhost ticket.sitename.com (/etc/apache2/sites-enabled/ticket.sitename.com.conf:15)
         port 443 namevhost www.sitename.com (/etc/apache2/sites-enabled/www.sitename.com.conf:63)
                 alias sitename.com:443

And here is water.sitename.conf in sites-enabled folder:

<VirtualHost *:80>
        ServerName water.sitename.com

        ServerAdmin [email protected]

        ErrorLog /var/log/apache2/water.sitename.com/error.log
        CustomLog /var/log/apache2/water.sitename.com/access.log combined

        DocumentRoot /var/www/drupal

        <Directory "/var/www/drupal/">
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
</VirtualHost>

Do you have any clue?

cn flag
Bob
Look for a `.htaccess` file or a an application level redirect since there isn’t anything in the virtual host entry that explains the redirect
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.