I have an issue with Apache vhosts. I requested redirection from HTTP to HTTPS (5001=http and 5002=https). The problem is that I’m experiencing a redirection from one domain to another, even though I never set this rule.
Could someone explain why this is happening?
My VHosts
VirtualHost configuration:
*:5001 sub1.domain.com (/etc/apache2/sites-enabled/sub1_domain.conf:1)
*:5002 sub1.domain.com (/etc/apache2/sites-enabled/sub1_domain.conf:8)
*:80 sub2.domain.com (/etc/apache2/sites-enabled/sub2_domain.conf:1)
*:443 sub2.domain.com (/etc/apache2/sites-enabled/sub2_domain.conf:8)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex fcgid-proctbl: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex fcgid-pipe: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
My cUrl request
C:Usersuser>curl -sv -o nul sub1.domain.com
* Host sub1.domain.com:80 was resolved.
* IPv6: (none)
* IPv4: 192.168.1.201
* Trying 192.168.1.201:80...
* Connected to sub1.domain.com (192.168.1.201) port 80
> GET / HTTP/1.1
> Host: sub1.domain.com
> User-Agent: curl/8.7.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Sat, 17 Aug 2024 19:31:10 GMT
< Server: Apache/2.4.61 (Debian)
< Location: https://sub2.domain.com/
< Content-Length: 328
< Content-Type: text/html; charset=iso-8859-1
<
{ [328 bytes data]
* Request completely sent off
* Connection #0 to host sub1.domain.com left intact