Mailing List Archive

Four subdomain, fourth redirects to first
Hi,

I have four subdomains on the same host which work as expected whis this
base config

<VirtualHost 4.DOMAIN.edu.ar:80>

ServerName 4.DOMAIN.edu.ar
ServerAlias 4.DOMAIN.edu.ar
ServerAdmin webmaster@DOMAIN.edu.ar

DocumentRoot /var/www/4

<Directory "/var/www/4">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error_4.log
CustomLog ${APACHE_LOG_DIR}/access_4.log combined

</VirtualHost>

In the particular case of fourth subdomain, gets redirected to the
first. See

# curl -v -H Host:4.DOMAIN.edu.ar http://INTERNAL-IP/
* Expire in 0 ms for 6 (transfer 0x55669ac96c10)
* Trying INTERNAL-IP...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x55669ac96c10)
* Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
> GET / HTTP/1.1
> Host:4.DOMAIN.edu.ar
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 21 Sep 2021 18:32:32 GMT
< Server: Apache/2.4.48
< X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
< X-Redirect-By: WordPress
< Location: https://1.DOMAIN.edu.ar/
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host INTERNAL-IP left intact

As said, domains 1, 3 and 3 works. In fact, when configuring the 4th
just copied the one of the working configs and changed the subdomain,
directory and also the log. Nothing more, but the result is not the one
I expected.


Any hint will be much appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Four subdomain, fourth redirects to first [ In reply to ]
The first mistake is to use the hostnames when defining vhosts. Define them
all as *:PORT, then test with curl, and run apachectl -S or httpd -S to
spot any overlap.

On Tue, 21 Sept 2021 at 14:48, Daniel Armando Rodriguez
<drodriguez@unau.edu.ar.invalid> wrote:

> Hi,
>
> I have four subdomains on the same host which work as expected whis this
> base config
>
> <VirtualHost 4.DOMAIN.edu.ar:80>
>
> ServerName 4.DOMAIN.edu.ar
> ServerAlias 4.DOMAIN.edu.ar
> ServerAdmin webmaster@DOMAIN.edu.ar
>
> DocumentRoot /var/www/4
>
> <Directory "/var/www/4">
> Options FollowSymLinks
> AllowOverride All
> Require all granted
> </Directory>
>
> ErrorLog ${APACHE_LOG_DIR}/error_4.log
> CustomLog ${APACHE_LOG_DIR}/access_4.log combined
>
> </VirtualHost>
>
> In the particular case of fourth subdomain, gets redirected to the
> first. See
>
> # curl -v -H Host:4.DOMAIN.edu.ar http://INTERNAL-IP/
> * Expire in 0 ms for 6 (transfer 0x55669ac96c10)
> * Trying INTERNAL-IP...
> * TCP_NODELAY set
> * Expire in 200 ms for 4 (transfer 0x55669ac96c10)
> * Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
> > GET / HTTP/1.1
> > Host:4.DOMAIN.edu.ar
> > User-Agent: curl/7.64.0
> > Accept: */*
> >
> < HTTP/1.1 301 Moved Permanently
> < Date: Tue, 21 Sep 2021 18:32:32 GMT
> < Server: Apache/2.4.48
> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
> < X-Redirect-By: WordPress
> < Location: https://1.DOMAIN.edu.ar/
> < Content-Length: 0
> < Content-Type: text/html; charset=UTF-8
> <
> * Connection #0 to host INTERNAL-IP left intact
>
> As said, domains 1, 3 and 3 works. In fact, when configuring the 4th
> just copied the one of the working configs and changed the subdomain,
> directory and also the log. Nothing more, but the result is not the one
> I expected.
>
>
> Any hint will be much appreciated.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: Four subdomain, fourth redirects to first [ In reply to ]
I have ~200 virtualhosts on my Apache HTTPD server and all use the declaration “<VirtualHost *>” with not port specification. Just a “Listen 80” directive. Do you specify the port on the VirtualHost directive because you don’t want to accept traffic on all the ports there are Listen directives for?

Darryl Baker, GSEC (he/him/his)
Sr. System Administrator
Distributed Application Platform Services
Northwestern University
1800 Sherman Ave.
Suite 6-600 – Box #39
Evanston, IL 60201-3715
darryl.baker@northwestern.edu<mailto:darryl.baker@northwestern.edu>
(847) 467-6674<tel:+18474676674>


From: Frank Gingras <thumbs@apache.org>
Reply-To: "users@httpd.apache.org" <users@httpd.apache.org>
Date: Tuesday, September 21, 2021 at 2:32 PM
Cc: "users@httpd.apache.org" <users@httpd.apache.org>
Subject: Re: [users@httpd] Four subdomain, fourth redirects to first

The first mistake is to use the hostnames when defining vhosts. Define them all as *:PORT, then test with curl, and run apachectl -S or httpd -S to spot any overlap.

On Tue, 21 Sept 2021 at 14:48, Daniel Armando Rodriguez <drodriguez@unau.edu.ar.invalid> wrote:
Hi,

I have four subdomains on the same host which work as expected whis this
base config

<VirtualHost 4.DOMAIN.edu.ar:80<https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar:80__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z4-6Yzyngw$>>

ServerName 4.DOMAIN.edu.ar<https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z488acxDmw$>
ServerAlias 4.DOMAIN.edu.ar<https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z488acxDmw$>
ServerAdmin webmaster@DOMAIN.edu.ar<mailto:webmaster@DOMAIN.edu.ar>

DocumentRoot /var/www/4

<Directory "/var/www/4">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error_4.log
CustomLog ${APACHE_LOG_DIR}/access_4.log combined

</VirtualHost>

In the particular case of fourth subdomain, gets redirected to the
first. See

# curl -v -H Host:4.DOMAIN.edu.ar<https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z488acxDmw$> http://INTERNAL-IP/<https://urldefense.com/v3/__http:/INTERNAL-IP/__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z4-egXBcKA$>
* Expire in 0 ms for 6 (transfer 0x55669ac96c10)
* Trying INTERNAL-IP...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x55669ac96c10)
* Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
> GET / HTTP/1.1
> Host:4.DOMAIN.edu.ar<https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z488acxDmw$>
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 21 Sep 2021 18:32:32 GMT
< Server: Apache/2.4.48
< X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php<https://urldefense.com/v3/__http:/1.DOMAIN.edu.ar/xmlrpc.php__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z4-gS0xl8g$>
< X-Redirect-By: WordPress
< Location: https://1.DOMAIN.edu.ar/<https://urldefense.com/v3/__https:/1.DOMAIN.edu.ar/__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z484EV85Bg$>
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host INTERNAL-IP left intact

As said, domains 1, 3 and 3 works. In fact, when configuring the 4th
just copied the one of the working configs and changed the subdomain,
directory and also the log. Nothing more, but the result is not the one
I expected.


Any hint will be much appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org<mailto:users-unsubscribe@httpd.apache.org>
For additional commands, e-mail: users-help@httpd.apache.org<mailto:users-help@httpd.apache.org>
Re: Four subdomain, fourth redirects to first [ In reply to ]
Darryl,

You can use * without the port under one specific condition:

You only listen to a single TLS or non-TLS port, and all vhosts are
configured to accept the traffic accordingly

Otherwise, you risk overlapping TLS and non-TLS vhosts, and your vhost will
not function properly.

On Tue, 21 Sept 2021 at 15:53, Darryl Philip Baker <
darryl.baker@northwestern.edu> wrote:

> I have ~200 virtualhosts on my Apache HTTPD server and all use the
> declaration “<VirtualHost *>” with not port specification. Just a “Listen
> 80” directive. Do you specify the port on the VirtualHost directive because
> you don’t want to accept traffic on all the ports there are Listen
> directives for?
>
>
>
> *Darryl Baker, *GSEC (he/him/his)
>
> Sr. System Administrator
>
> Distributed Application Platform Services
>
> *Northwestern University*
>
> 1800 Sherman Ave.
>
> Suite 6-600 – Box #39
>
> Evanston, IL 60201-3715
>
> *darryl.baker@northwestern.edu <darryl.baker@northwestern.edu>*
>
> (847) 467-6674 <+18474676674>
>
>
>
>
>
> *From: *Frank Gingras <thumbs@apache.org>
> *Reply-To: *"users@httpd.apache.org" <users@httpd.apache.org>
> *Date: *Tuesday, September 21, 2021 at 2:32 PM
> *Cc: *"users@httpd.apache.org" <users@httpd.apache.org>
> *Subject: *Re: [users@httpd] Four subdomain, fourth redirects to first
>
>
>
> The first mistake is to use the hostnames when defining vhosts. Define
> them all as *:PORT, then test with curl, and run apachectl -S or httpd -S
> to spot any overlap.
>
>
>
> On Tue, 21 Sept 2021 at 14:48, Daniel Armando Rodriguez
> <drodriguez@unau.edu.ar.invalid> wrote:
>
> Hi,
>
> I have four subdomains on the same host which work as expected whis this
> base config
>
> <VirtualHost 4.DOMAIN.edu.ar:80
> <https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar:80__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z4-6Yzyngw$>
> >
>
> ServerName 4.DOMAIN.edu.ar
> <https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z488acxDmw$>
> ServerAlias 4.DOMAIN.edu.ar
> <https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z488acxDmw$>
> ServerAdmin webmaster@DOMAIN.edu.ar
>
> DocumentRoot /var/www/4
>
> <Directory "/var/www/4">
> Options FollowSymLinks
> AllowOverride All
> Require all granted
> </Directory>
>
> ErrorLog ${APACHE_LOG_DIR}/error_4.log
> CustomLog ${APACHE_LOG_DIR}/access_4.log combined
>
> </VirtualHost>
>
> In the particular case of fourth subdomain, gets redirected to the
> first. See
>
> # curl -v -H Host:4.DOMAIN.edu.ar
> <https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z488acxDmw$>
> http://INTERNAL-IP/
> <https://urldefense.com/v3/__http:/INTERNAL-IP/__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z4-egXBcKA$>
> * Expire in 0 ms for 6 (transfer 0x55669ac96c10)
> * Trying INTERNAL-IP...
> * TCP_NODELAY set
> * Expire in 200 ms for 4 (transfer 0x55669ac96c10)
> * Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
> > GET / HTTP/1.1
> > Host:4.DOMAIN.edu.ar
> <https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z488acxDmw$>
> > User-Agent: curl/7.64.0
> > Accept: */*
> >
> < HTTP/1.1 301 Moved Permanently
> < Date: Tue, 21 Sep 2021 18:32:32 GMT
> < Server: Apache/2.4.48
> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
> <https://urldefense.com/v3/__http:/1.DOMAIN.edu.ar/xmlrpc.php__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z4-gS0xl8g$>
> < X-Redirect-By: WordPress
> < Location: https://1.DOMAIN.edu.ar/
> <https://urldefense.com/v3/__https:/1.DOMAIN.edu.ar/__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z484EV85Bg$>
> < Content-Length: 0
> < Content-Type: text/html; charset=UTF-8
> <
> * Connection #0 to host INTERNAL-IP left intact
>
> As said, domains 1, 3 and 3 works. In fact, when configuring the 4th
> just copied the one of the working configs and changed the subdomain,
> directory and also the log. Nothing more, but the result is not the one
> I expected.
>
>
> Any hint will be much appreciated.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: Four subdomain, fourth redirects to first [ In reply to ]
El 2021-09-21 16:47, Darryl Philip Baker escribió:
> I have ~200 virtualhosts on my Apache HTTPD server and all use the
> declaration “<VirtualHost *>” with not port specification. Just a
> “Listen 80” directive. Do you specify the port on the VirtualHost
> directive because you don’t want to accept traffic on all the ports
> there are Listen directives for?

At some point I was told to do so in order to solve a circumstantial
problem that had arisen. I think that, from that point on, it became a
habit.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Four subdomain, fourth redirects to first [ In reply to ]
Changed all vhosts definition the way you suggested, but the issue still
happens.


El 2021-09-21 16:32, Frank Gingras escribió:
> The first mistake is to use the hostnames when defining vhosts. Define
> them all as *:PORT, then test with curl, and run apachectl -S or httpd
> -S to spot any overlap.
>
> On Tue, 21 Sept 2021 at 14:48, Daniel Armando Rodriguez
> <drodriguez@unau.edu.ar.invalid> wrote:
>
>> Hi,
>>
>> I have four subdomains on the same host which work as expected whis
>> this
>> base config
>>
>> <VirtualHost 4.DOMAIN.edu.ar:80 [1]>
>>
>> ServerName 4.DOMAIN.edu.ar [2]
>> ServerAlias 4.DOMAIN.edu.ar [2]
>> ServerAdmin webmaster@DOMAIN.edu.ar
>>
>> DocumentRoot /var/www/4
>>
>> <Directory "/var/www/4">
>> Options FollowSymLinks
>> AllowOverride All
>> Require all granted
>> </Directory>
>>
>> ErrorLog ${APACHE_LOG_DIR}/error_4.log
>> CustomLog ${APACHE_LOG_DIR}/access_4.log combined
>>
>> </VirtualHost>
>>
>> In the particular case of fourth subdomain, gets redirected to the
>> first. See
>>
>> # curl -v -H Host:4.DOMAIN.edu.ar [2] http://INTERNAL-IP/
>> * Expire in 0 ms for 6 (transfer 0x55669ac96c10)
>> * Trying INTERNAL-IP...
>> * TCP_NODELAY set
>> * Expire in 200 ms for 4 (transfer 0x55669ac96c10)
>> * Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
>>> GET / HTTP/1.1
>>> Host:4.DOMAIN.edu.ar [2]
>>> User-Agent: curl/7.64.0
>>> Accept: */*
>>>
>> < HTTP/1.1 301 Moved Permanently
>> < Date: Tue, 21 Sep 2021 18:32:32 GMT
>> < Server: Apache/2.4.48
>> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
>> < X-Redirect-By: WordPress
>> < Location: https://1.DOMAIN.edu.ar/
>> < Content-Length: 0
>> < Content-Type: text/html; charset=UTF-8
>> <
>> * Connection #0 to host INTERNAL-IP left intact
>>
>> As said, domains 1, 3 and 3 works. In fact, when configuring the 4th
>>
>> just copied the one of the working configs and changed the
>> subdomain,
>> directory and also the log. Nothing more, but the result is not the
>> one
>> I expected.
>>
>> Any hint will be much appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Four subdomain, fourth redirects to first [ In reply to ]
Show the httpd -S output and results from your tests with curl, then.

It might help to log the host: header in your access log too.

On Tue, 21 Sept 2021 at 17:41, Daniel Armando Rodriguez
<drodriguez@unau.edu.ar.invalid> wrote:

> Changed all vhosts definition the way you suggested, but the issue still
> happens.
>
>
> El 2021-09-21 16:32, Frank Gingras escribió:
> > The first mistake is to use the hostnames when defining vhosts. Define
> > them all as *:PORT, then test with curl, and run apachectl -S or httpd
> > -S to spot any overlap.
> >
> > On Tue, 21 Sept 2021 at 14:48, Daniel Armando Rodriguez
> > <drodriguez@unau.edu.ar.invalid> wrote:
> >
> >> Hi,
> >>
> >> I have four subdomains on the same host which work as expected whis
> >> this
> >> base config
> >>
> >> <VirtualHost 4.DOMAIN.edu.ar:80 [1]>
> >>
> >> ServerName 4.DOMAIN.edu.ar [2]
> >> ServerAlias 4.DOMAIN.edu.ar [2]
> >> ServerAdmin webmaster@DOMAIN.edu.ar
> >>
> >> DocumentRoot /var/www/4
> >>
> >> <Directory "/var/www/4">
> >> Options FollowSymLinks
> >> AllowOverride All
> >> Require all granted
> >> </Directory>
> >>
> >> ErrorLog ${APACHE_LOG_DIR}/error_4.log
> >> CustomLog ${APACHE_LOG_DIR}/access_4.log combined
> >>
> >> </VirtualHost>
> >>
> >> In the particular case of fourth subdomain, gets redirected to the
> >> first. See
> >>
> >> # curl -v -H Host:4.DOMAIN.edu.ar [2] http://INTERNAL-IP/
> >> * Expire in 0 ms for 6 (transfer 0x55669ac96c10)
> >> * Trying INTERNAL-IP...
> >> * TCP_NODELAY set
> >> * Expire in 200 ms for 4 (transfer 0x55669ac96c10)
> >> * Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
> >>> GET / HTTP/1.1
> >>> Host:4.DOMAIN.edu.ar [2]
> >>> User-Agent: curl/7.64.0
> >>> Accept: */*
> >>>
> >> < HTTP/1.1 301 Moved Permanently
> >> < Date: Tue, 21 Sep 2021 18:32:32 GMT
> >> < Server: Apache/2.4.48
> >> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
> >> < X-Redirect-By: WordPress
> >> < Location: https://1.DOMAIN.edu.ar/
> >> < Content-Length: 0
> >> < Content-Type: text/html; charset=UTF-8
> >> <
> >> * Connection #0 to host INTERNAL-IP left intact
> >>
> >> As said, domains 1, 3 and 3 works. In fact, when configuring the 4th
> >>
> >> just copied the one of the working configs and changed the
> >> subdomain,
> >> directory and also the log. Nothing more, but the result is not the
> >> one
> >> I expected.
> >>
> >> Any hint will be much appreciated.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: Four subdomain, fourth redirects to first [ In reply to ]
Here it is the curl result from the same host

# curl -v -H Host:4.DOMAIN.edu.ar http://INTERNAL-IP/
* Expire in 0 ms for 6 (transfer 0x5573684c6c10)
* Trying INTERNAL-IP...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x5573684c6c10)
* Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
> GET / HTTP/1.1
> Host:4.DOMAIN.edu.ar
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 21 Sep 2021 22:10:39 GMT
< Server: Apache/2.4.48
< X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
< X-Redirect-By: WordPress
< Location: https://1.DOMAIN.edu.ar/
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host INTERNAL-IP left intact

Querying to localhost

# curl -v -H Host:4.DOMAIN.edu.ar http://localhost/
* Expire in 0 ms for 6 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Trying ::1...
* TCP_NODELAY set
* Expire in 150000 ms for 3 (transfer 0x5556238fac10)
* Expire in 200 ms for 4 (transfer 0x5556238fac10)
* Connected to localhost (::1) port 80 (#0)
> GET / HTTP/1.1
> Host:4.DOMAIN.edu.ar
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 21 Sep 2021 22:13:01 GMT
< Server: Apache/2.4.48
< X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
< X-Redirect-By: WordPress
< Location: https://1.DOMAIN.edu.ar/
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host localhost left intact

From apachectl -S I see the problem is related to what vhost is set as
default
VirtualHost configuration:
*:80 is a NameVirtualHost
default server 4.DOMAIN.edu.ar
(/etc/apache2/sites-enabled/1.DOMAIN.conf:1)
port 80 namevhost 4.DOMAIN.edu.ar
(/etc/apache2/sites-enabled/1.DOMAIN.conf:1)
alias 1.DOMAIN.edu.ar
port 80 namevhost 4.DOMAIN.edu.ar
(/etc/apache2/sites-enabled/2.DOMAIN.conf:1)
alias 2.DOMAIN.edu.ar
port 80 namevhost 4.DOMAIN.edu.ar
(/etc/apache2/sites-enabled/4.DOMAIN.conf:1)
alias 4.DOMAIN.edu.ar
port 80 namevhost 4.DOMAIN.edu.ar
(/etc/apache2/sites-enabled/3.DOMAIN.conf:1)
alias 3.DOMAIN.unau.edu.ar
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: 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




El 2021-09-21 18:48, Frank Gingras escribió:
> Show the httpd -S output and results from your tests with curl, then.
>
> It might help to log the host: header in your access log too.
>
> On Tue, 21 Sept 2021 at 17:41, Daniel Armando Rodriguez
> <drodriguez@unau.edu.ar.invalid> wrote:
>
>> Changed all vhosts definition the way you suggested, but the issue
>> still
>> happens.
>>
>> El 2021-09-21 16:32, Frank Gingras escribió:
>>> The first mistake is to use the hostnames when defining vhosts.
>> Define
>>> them all as *:PORT, then test with curl, and run apachectl -S or
>> httpd
>>> -S to spot any overlap.
>>>
>>> On Tue, 21 Sept 2021 at 14:48, Daniel Armando Rodriguez
>>> <drodriguez@unau.edu.ar.invalid> wrote:
>>>
>>>> Hi,
>>>>
>>>> I have four subdomains on the same host which work as expected
>> whis
>>>> this
>>>> base config
>>>>
>>>> <VirtualHost 4.DOMAIN.edu.ar:80 [1] [1]>
>>>>
>>>> ServerName 4.DOMAIN.edu.ar [2] [2]
>>>> ServerAlias 4.DOMAIN.edu.ar [2] [2]
>>>> ServerAdmin webmaster@DOMAIN.edu.ar
>>>>
>>>> DocumentRoot /var/www/4
>>>>
>>>> <Directory "/var/www/4">
>>>> Options FollowSymLinks
>>>> AllowOverride All
>>>> Require all granted
>>>> </Directory>
>>>>
>>>> ErrorLog ${APACHE_LOG_DIR}/error_4.log
>>>> CustomLog ${APACHE_LOG_DIR}/access_4.log combined
>>>>
>>>> </VirtualHost>
>>>>
>>>> In the particular case of fourth subdomain, gets redirected to
>> the
>>>> first. See
>>>>
>>>> # curl -v -H Host:4.DOMAIN.edu.ar [2] [2] http://INTERNAL-IP/
>>>> * Expire in 0 ms for 6 (transfer 0x55669ac96c10)
>>>> * Trying INTERNAL-IP...
>>>> * TCP_NODELAY set
>>>> * Expire in 200 ms for 4 (transfer 0x55669ac96c10)
>>>> * Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
>>>>> GET / HTTP/1.1
>>>>> Host:4.DOMAIN.edu.ar [2] [2]
>>>>> User-Agent: curl/7.64.0
>>>>> Accept: */*
>>>>>
>>>> < HTTP/1.1 301 Moved Permanently
>>>> < Date: Tue, 21 Sep 2021 18:32:32 GMT
>>>> < Server: Apache/2.4.48
>>>> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
>>>> < X-Redirect-By: WordPress
>>>> < Location: https://1.DOMAIN.edu.ar/
>>>> < Content-Length: 0
>>>> < Content-Type: text/html; charset=UTF-8
>>>> <
>>>> * Connection #0 to host INTERNAL-IP left intact
>>>>
>>>> As said, domains 1, 3 and 3 works. In fact, when configuring the
>> 4th
>>>>
>>>> just copied the one of the working configs and changed the
>>>> subdomain,
>>>> directory and also the log. Nothing more, but the result is not
>> the
>>>> one
>>>> I expected.
>>>>
>>>> Any hint will be much appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Four subdomain, fourth redirects to first [ In reply to ]
On 2021-09-21 6:25 p.m., Daniel Armando Rodriguez wrote:
> Here it is the curl result from the same host

[snip]
>
> From apachectl -S I see the problem is related to what vhost is set as
> default
> VirtualHost configuration:
> *:80                   is a NameVirtualHost
>          default server 4.DOMAIN.edu.ar
> (/etc/apache2/sites-enabled/1.DOMAIN.conf:1)

What does ls -al /etc/apache2/sites-enabled show? You should most
probably not have a "default", particularly '4.DOMAIN' referencing
'1.DOMAIN'

hth -- P.


>          port 80 namevhost 4.DOMAIN.edu.ar
> (/etc/apache2/sites-enabled/1.DOMAIN.conf:1)
>                  alias 1.DOMAIN.edu.ar
>          port 80 namevhost 4.DOMAIN.edu.ar
> (/etc/apache2/sites-enabled/2.DOMAIN.conf:1)
>                  alias 2.DOMAIN.edu.ar
>          port 80 namevhost 4.DOMAIN.edu.ar
> (/etc/apache2/sites-enabled/4.DOMAIN.conf:1)
>                  alias 4.DOMAIN.edu.ar
>          port 80 namevhost 4.DOMAIN.edu.ar
> (/etc/apache2/sites-enabled/3.DOMAIN.conf:1)
>                  alias 3.DOMAIN.unau.edu.ar
> ServerRoot: "/etc/apache2"
> Main DocumentRoot: "/var/www/html"
> Main ErrorLog: "/var/log/apache2/error.log"
> Mutex ssl-stapling: using_defaults
> Mutex ssl-cache: using_defaults
> Mutex default: dir="/var/run/apache2/" mechanism=default
> Mutex mpm-accept: using_defaults
> Mutex watchdog-callback: using_defaults
> Mutex rewrite-map: using_defaults
> Mutex ssl-stapling-refresh: 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
>
>
>
>
> El 2021-09-21 18:48, Frank Gingras escribió:
>> Show the httpd -S output and results from your tests with curl, then.
>>
>> It might help to log the host: header in your access log too.
>>
>> On Tue, 21 Sept 2021 at 17:41, Daniel Armando Rodriguez
>> <drodriguez@unau.edu.ar.invalid> wrote:
>>
>>> Changed all vhosts definition the way you suggested, but the issue
>>> still
>>> happens.
>>>
>>> El 2021-09-21 16:32, Frank Gingras escribió:
>>>> The first mistake is to use the hostnames when defining vhosts.
>>> Define
>>>> them all as *:PORT, then test with curl, and run apachectl -S or
>>> httpd
>>>> -S to spot any overlap.
>>>>
>>>> On Tue, 21 Sept 2021 at 14:48, Daniel Armando Rodriguez
>>>> <drodriguez@unau.edu.ar.invalid> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have four subdomains on the same host which work as expected
>>> whis
>>>>> this
>>>>> base config
>>>>>
>>>>> <VirtualHost 4.DOMAIN.edu.ar:80 [1] [1]>
>>>>>
>>>>> ServerName 4.DOMAIN.edu.ar [2] [2]
>>>>> ServerAlias 4.DOMAIN.edu.ar [2] [2]
>>>>> ServerAdmin webmaster@DOMAIN.edu.ar
>>>>>
>>>>> DocumentRoot /var/www/4
>>>>>
>>>>> <Directory "/var/www/4">
>>>>> Options FollowSymLinks
>>>>> AllowOverride All
>>>>> Require all granted
>>>>> </Directory>
>>>>>
>>>>> ErrorLog ${APACHE_LOG_DIR}/error_4.log
>>>>> CustomLog ${APACHE_LOG_DIR}/access_4.log combined
>>>>>
>>>>> </VirtualHost>
>>>>>
>>>>> In the particular case of fourth subdomain, gets redirected to
>>> the
>>>>> first. See
>>>>>
>>>>> # curl -v -H Host:4.DOMAIN.edu.ar [2] [2] http://INTERNAL-IP/
>>>>> * Expire in 0 ms for 6 (transfer 0x55669ac96c10)
>>>>> *   Trying INTERNAL-IP...
>>>>> * TCP_NODELAY set
>>>>> * Expire in 200 ms for 4 (transfer 0x55669ac96c10)
>>>>> * Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
>>>>>> GET / HTTP/1.1
>>>>>> Host:4.DOMAIN.edu.ar [2] [2]
>>>>>> User-Agent: curl/7.64.0
>>>>>> Accept: */*
>>>>>>
>>>>> < HTTP/1.1 301 Moved Permanently
>>>>> < Date: Tue, 21 Sep 2021 18:32:32 GMT
>>>>> < Server: Apache/2.4.48
>>>>> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
>>>>> < X-Redirect-By: WordPress
>>>>> < Location: https://1.DOMAIN.edu.ar/
>>>>> < Content-Length: 0
>>>>> < Content-Type: text/html; charset=UTF-8
>>>>> <
>>>>> * Connection #0 to host INTERNAL-IP left intact
>>>>>
>>>>> As said, domains 1, 3 and 3 works. In fact, when configuring the
>>> 4th
>>>>>
>>>>> just copied the one of the working configs and changed the
>>>>> subdomain,
>>>>> directory and also the log. Nothing more, but the result is not
>>> the
>>>>> one
>>>>> I expected.
>>>>>
>>>>> Any hint will be much appreciated.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Four subdomain, fourth redirects to first [ In reply to ]
Why do you have two vhosts with the same ServerName value set? That will
break name-based vhosts. Set a unique ServerName value for every vhost on
that port.

On Tue, 21 Sept 2021 at 18:25, Daniel Armando Rodriguez
<drodriguez@unau.edu.ar.invalid> wrote:

> Here it is the curl result from the same host
>
> # curl -v -H Host:4.DOMAIN.edu.ar http://INTERNAL-IP/
> * Expire in 0 ms for 6 (transfer 0x5573684c6c10)
> * Trying INTERNAL-IP...
> * TCP_NODELAY set
> * Expire in 200 ms for 4 (transfer 0x5573684c6c10)
> * Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
> > GET / HTTP/1.1
> > Host:4.DOMAIN.edu.ar
> > User-Agent: curl/7.64.0
> > Accept: */*
> >
> < HTTP/1.1 301 Moved Permanently
> < Date: Tue, 21 Sep 2021 22:10:39 GMT
> < Server: Apache/2.4.48
> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
> < X-Redirect-By: WordPress
> < Location: https://1.DOMAIN.edu.ar/
> < Content-Length: 0
> < Content-Type: text/html; charset=UTF-8
> <
> * Connection #0 to host INTERNAL-IP left intact
>
> Querying to localhost
>
> # curl -v -H Host:4.DOMAIN.edu.ar http://localhost/
> * Expire in 0 ms for 6 (transfer 0x5556238fac10)
> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
> * Trying ::1...
> * TCP_NODELAY set
> * Expire in 150000 ms for 3 (transfer 0x5556238fac10)
> * Expire in 200 ms for 4 (transfer 0x5556238fac10)
> * Connected to localhost (::1) port 80 (#0)
> > GET / HTTP/1.1
> > Host:4.DOMAIN.edu.ar
> > User-Agent: curl/7.64.0
> > Accept: */*
> >
> < HTTP/1.1 301 Moved Permanently
> < Date: Tue, 21 Sep 2021 22:13:01 GMT
> < Server: Apache/2.4.48
> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
> < X-Redirect-By: WordPress
> < Location: https://1.DOMAIN.edu.ar/
> < Content-Length: 0
> < Content-Type: text/html; charset=UTF-8
> <
> * Connection #0 to host localhost left intact
>
> From apachectl -S I see the problem is related to what vhost is set as
> default
> VirtualHost configuration:
> *:80 is a NameVirtualHost
> default server 4.DOMAIN.edu.ar
> (/etc/apache2/sites-enabled/1.DOMAIN.conf:1)
> port 80 namevhost 4.DOMAIN.edu.ar
> (/etc/apache2/sites-enabled/1.DOMAIN.conf:1)
> alias 1.DOMAIN.edu.ar
> port 80 namevhost 4.DOMAIN.edu.ar
> (/etc/apache2/sites-enabled/2.DOMAIN.conf:1)
> alias 2.DOMAIN.edu.ar
> port 80 namevhost 4.DOMAIN.edu.ar
> (/etc/apache2/sites-enabled/4.DOMAIN.conf:1)
> alias 4.DOMAIN.edu.ar
> port 80 namevhost 4.DOMAIN.edu.ar
> (/etc/apache2/sites-enabled/3.DOMAIN.conf:1)
> alias 3.DOMAIN.unau.edu.ar
> ServerRoot: "/etc/apache2"
> Main DocumentRoot: "/var/www/html"
> Main ErrorLog: "/var/log/apache2/error.log"
> Mutex ssl-stapling: using_defaults
> Mutex ssl-cache: using_defaults
> Mutex default: dir="/var/run/apache2/" mechanism=default
> Mutex mpm-accept: using_defaults
> Mutex watchdog-callback: using_defaults
> Mutex rewrite-map: using_defaults
> Mutex ssl-stapling-refresh: 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
>
>
>
>
> El 2021-09-21 18:48, Frank Gingras escribió:
> > Show the httpd -S output and results from your tests with curl, then.
> >
> > It might help to log the host: header in your access log too.
> >
> > On Tue, 21 Sept 2021 at 17:41, Daniel Armando Rodriguez
> > <drodriguez@unau.edu.ar.invalid> wrote:
> >
> >> Changed all vhosts definition the way you suggested, but the issue
> >> still
> >> happens.
> >>
> >> El 2021-09-21 16:32, Frank Gingras escribió:
> >>> The first mistake is to use the hostnames when defining vhosts.
> >> Define
> >>> them all as *:PORT, then test with curl, and run apachectl -S or
> >> httpd
> >>> -S to spot any overlap.
> >>>
> >>> On Tue, 21 Sept 2021 at 14:48, Daniel Armando Rodriguez
> >>> <drodriguez@unau.edu.ar.invalid> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> I have four subdomains on the same host which work as expected
> >> whis
> >>>> this
> >>>> base config
> >>>>
> >>>> <VirtualHost 4.DOMAIN.edu.ar:80 [1] [1]>
> >>>>
> >>>> ServerName 4.DOMAIN.edu.ar [2] [2]
> >>>> ServerAlias 4.DOMAIN.edu.ar [2] [2]
> >>>> ServerAdmin webmaster@DOMAIN.edu.ar
> >>>>
> >>>> DocumentRoot /var/www/4
> >>>>
> >>>> <Directory "/var/www/4">
> >>>> Options FollowSymLinks
> >>>> AllowOverride All
> >>>> Require all granted
> >>>> </Directory>
> >>>>
> >>>> ErrorLog ${APACHE_LOG_DIR}/error_4.log
> >>>> CustomLog ${APACHE_LOG_DIR}/access_4.log combined
> >>>>
> >>>> </VirtualHost>
> >>>>
> >>>> In the particular case of fourth subdomain, gets redirected to
> >> the
> >>>> first. See
> >>>>
> >>>> # curl -v -H Host:4.DOMAIN.edu.ar [2] [2] http://INTERNAL-IP/
> >>>> * Expire in 0 ms for 6 (transfer 0x55669ac96c10)
> >>>> * Trying INTERNAL-IP...
> >>>> * TCP_NODELAY set
> >>>> * Expire in 200 ms for 4 (transfer 0x55669ac96c10)
> >>>> * Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
> >>>>> GET / HTTP/1.1
> >>>>> Host:4.DOMAIN.edu.ar [2] [2]
> >>>>> User-Agent: curl/7.64.0
> >>>>> Accept: */*
> >>>>>
> >>>> < HTTP/1.1 301 Moved Permanently
> >>>> < Date: Tue, 21 Sep 2021 18:32:32 GMT
> >>>> < Server: Apache/2.4.48
> >>>> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
> >>>> < X-Redirect-By: WordPress
> >>>> < Location: https://1.DOMAIN.edu.ar/
> >>>> < Content-Length: 0
> >>>> < Content-Type: text/html; charset=UTF-8
> >>>> <
> >>>> * Connection #0 to host INTERNAL-IP left intact
> >>>>
> >>>> As said, domains 1, 3 and 3 works. In fact, when configuring the
> >> 4th
> >>>>
> >>>> just copied the one of the working configs and changed the
> >>>> subdomain,
> >>>> directory and also the log. Nothing more, but the result is not
> >> the
> >>>> one
> >>>> I expected.
> >>>>
> >>>> Any hint will be much appreciated.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: Four subdomain, fourth redirects to first [ In reply to ]
I would not rely on the debian scripts. Looking at apachectl -S will tell
you what you need to know.

On Tue, 21 Sept 2021 at 18:51, Frank Gingras <thumbs@apache.org> wrote:

> Why do you have two vhosts with the same ServerName value set? That will
> break name-based vhosts. Set a unique ServerName value for every vhost on
> that port.
>
> On Tue, 21 Sept 2021 at 18:25, Daniel Armando Rodriguez
> <drodriguez@unau.edu.ar.invalid> wrote:
>
>> Here it is the curl result from the same host
>>
>> # curl -v -H Host:4.DOMAIN.edu.ar http://INTERNAL-IP/
>> * Expire in 0 ms for 6 (transfer 0x5573684c6c10)
>> * Trying INTERNAL-IP...
>> * TCP_NODELAY set
>> * Expire in 200 ms for 4 (transfer 0x5573684c6c10)
>> * Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
>> > GET / HTTP/1.1
>> > Host:4.DOMAIN.edu.ar
>> > User-Agent: curl/7.64.0
>> > Accept: */*
>> >
>> < HTTP/1.1 301 Moved Permanently
>> < Date: Tue, 21 Sep 2021 22:10:39 GMT
>> < Server: Apache/2.4.48
>> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
>> < X-Redirect-By: WordPress
>> < Location: https://1.DOMAIN.edu.ar/
>> < Content-Length: 0
>> < Content-Type: text/html; charset=UTF-8
>> <
>> * Connection #0 to host INTERNAL-IP left intact
>>
>> Querying to localhost
>>
>> # curl -v -H Host:4.DOMAIN.edu.ar http://localhost/
>> * Expire in 0 ms for 6 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Trying ::1...
>> * TCP_NODELAY set
>> * Expire in 150000 ms for 3 (transfer 0x5556238fac10)
>> * Expire in 200 ms for 4 (transfer 0x5556238fac10)
>> * Connected to localhost (::1) port 80 (#0)
>> > GET / HTTP/1.1
>> > Host:4.DOMAIN.edu.ar
>> > User-Agent: curl/7.64.0
>> > Accept: */*
>> >
>> < HTTP/1.1 301 Moved Permanently
>> < Date: Tue, 21 Sep 2021 22:13:01 GMT
>> < Server: Apache/2.4.48
>> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
>> < X-Redirect-By: WordPress
>> < Location: https://1.DOMAIN.edu.ar/
>> < Content-Length: 0
>> < Content-Type: text/html; charset=UTF-8
>> <
>> * Connection #0 to host localhost left intact
>>
>> From apachectl -S I see the problem is related to what vhost is set as
>> default
>> VirtualHost configuration:
>> *:80 is a NameVirtualHost
>> default server 4.DOMAIN.edu.ar
>> (/etc/apache2/sites-enabled/1.DOMAIN.conf:1)
>> port 80 namevhost 4.DOMAIN.edu.ar
>> (/etc/apache2/sites-enabled/1.DOMAIN.conf:1)
>> alias 1.DOMAIN.edu.ar
>> port 80 namevhost 4.DOMAIN.edu.ar
>> (/etc/apache2/sites-enabled/2.DOMAIN.conf:1)
>> alias 2.DOMAIN.edu.ar
>> port 80 namevhost 4.DOMAIN.edu.ar
>> (/etc/apache2/sites-enabled/4.DOMAIN.conf:1)
>> alias 4.DOMAIN.edu.ar
>> port 80 namevhost 4.DOMAIN.edu.ar
>> (/etc/apache2/sites-enabled/3.DOMAIN.conf:1)
>> alias 3.DOMAIN.unau.edu.ar
>> ServerRoot: "/etc/apache2"
>> Main DocumentRoot: "/var/www/html"
>> Main ErrorLog: "/var/log/apache2/error.log"
>> Mutex ssl-stapling: using_defaults
>> Mutex ssl-cache: using_defaults
>> Mutex default: dir="/var/run/apache2/" mechanism=default
>> Mutex mpm-accept: using_defaults
>> Mutex watchdog-callback: using_defaults
>> Mutex rewrite-map: using_defaults
>> Mutex ssl-stapling-refresh: 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
>>
>>
>>
>>
>> El 2021-09-21 18:48, Frank Gingras escribió:
>> > Show the httpd -S output and results from your tests with curl, then.
>> >
>> > It might help to log the host: header in your access log too.
>> >
>> > On Tue, 21 Sept 2021 at 17:41, Daniel Armando Rodriguez
>> > <drodriguez@unau.edu.ar.invalid> wrote:
>> >
>> >> Changed all vhosts definition the way you suggested, but the issue
>> >> still
>> >> happens.
>> >>
>> >> El 2021-09-21 16:32, Frank Gingras escribió:
>> >>> The first mistake is to use the hostnames when defining vhosts.
>> >> Define
>> >>> them all as *:PORT, then test with curl, and run apachectl -S or
>> >> httpd
>> >>> -S to spot any overlap.
>> >>>
>> >>> On Tue, 21 Sept 2021 at 14:48, Daniel Armando Rodriguez
>> >>> <drodriguez@unau.edu.ar.invalid> wrote:
>> >>>
>> >>>> Hi,
>> >>>>
>> >>>> I have four subdomains on the same host which work as expected
>> >> whis
>> >>>> this
>> >>>> base config
>> >>>>
>> >>>> <VirtualHost 4.DOMAIN.edu.ar:80 [1] [1]>
>> >>>>
>> >>>> ServerName 4.DOMAIN.edu.ar [2] [2]
>> >>>> ServerAlias 4.DOMAIN.edu.ar [2] [2]
>> >>>> ServerAdmin webmaster@DOMAIN.edu.ar
>> >>>>
>> >>>> DocumentRoot /var/www/4
>> >>>>
>> >>>> <Directory "/var/www/4">
>> >>>> Options FollowSymLinks
>> >>>> AllowOverride All
>> >>>> Require all granted
>> >>>> </Directory>
>> >>>>
>> >>>> ErrorLog ${APACHE_LOG_DIR}/error_4.log
>> >>>> CustomLog ${APACHE_LOG_DIR}/access_4.log combined
>> >>>>
>> >>>> </VirtualHost>
>> >>>>
>> >>>> In the particular case of fourth subdomain, gets redirected to
>> >> the
>> >>>> first. See
>> >>>>
>> >>>> # curl -v -H Host:4.DOMAIN.edu.ar [2] [2] http://INTERNAL-IP/
>> >>>> * Expire in 0 ms for 6 (transfer 0x55669ac96c10)
>> >>>> * Trying INTERNAL-IP...
>> >>>> * TCP_NODELAY set
>> >>>> * Expire in 200 ms for 4 (transfer 0x55669ac96c10)
>> >>>> * Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
>> >>>>> GET / HTTP/1.1
>> >>>>> Host:4.DOMAIN.edu.ar [2] [2]
>> >>>>> User-Agent: curl/7.64.0
>> >>>>> Accept: */*
>> >>>>>
>> >>>> < HTTP/1.1 301 Moved Permanently
>> >>>> < Date: Tue, 21 Sep 2021 18:32:32 GMT
>> >>>> < Server: Apache/2.4.48
>> >>>> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
>> >>>> < X-Redirect-By: WordPress
>> >>>> < Location: https://1.DOMAIN.edu.ar/
>> >>>> < Content-Length: 0
>> >>>> < Content-Type: text/html; charset=UTF-8
>> >>>> <
>> >>>> * Connection #0 to host INTERNAL-IP left intact
>> >>>>
>> >>>> As said, domains 1, 3 and 3 works. In fact, when configuring the
>> >> 4th
>> >>>>
>> >>>> just copied the one of the working configs and changed the
>> >>>> subdomain,
>> >>>> directory and also the log. Nothing more, but the result is not
>> >> the
>> >>>> one
>> >>>> I expected.
>> >>>>
>> >>>> Any hint will be much appreciated.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
Re: Four subdomain, fourth redirects to first [ In reply to ]
The host I'm using was originally named accordingly with the task
assigned back then, now one of the vhosts has the same name.

But, after noticed the issue just renamed the conf, and now everything
is working as expected.


Thank you all for your time and patience.-


El 2021-09-21 19:51, Frank Gingras escribió:
> Why do you have two vhosts with the same ServerName value set? That
> will break name-based vhosts. Set a unique ServerName value for every
> vhost on that port.
>
> On Tue, 21 Sept 2021 at 18:25, Daniel Armando Rodriguez
> <drodriguez@unau.edu.ar.invalid> wrote:
>
>> Here it is the curl result from the same host
>>
>> # curl -v -H Host:4.DOMAIN.edu.ar [1] http://INTERNAL-IP/
>> * Expire in 0 ms for 6 (transfer 0x5573684c6c10)
>> * Trying INTERNAL-IP...
>> * TCP_NODELAY set
>> * Expire in 200 ms for 4 (transfer 0x5573684c6c10)
>> * Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
>>> GET / HTTP/1.1
>>> Host:4.DOMAIN.edu.ar [1]
>>> User-Agent: curl/7.64.0
>>> Accept: */*
>>>
>> < HTTP/1.1 301 Moved Permanently
>> < Date: Tue, 21 Sep 2021 22:10:39 GMT
>> < Server: Apache/2.4.48
>> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
>> < X-Redirect-By: WordPress
>> < Location: https://1.DOMAIN.edu.ar/
>> < Content-Length: 0
>> < Content-Type: text/html; charset=UTF-8
>> <
>> * Connection #0 to host INTERNAL-IP left intact
>>
>> Querying to localhost
>>
>> # curl -v -H Host:4.DOMAIN.edu.ar [1] http://localhost/
>> * Expire in 0 ms for 6 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 1 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Expire in 0 ms for 1 (transfer 0x5556238fac10)
>> * Trying ::1...
>> * TCP_NODELAY set
>> * Expire in 150000 ms for 3 (transfer 0x5556238fac10)
>> * Expire in 200 ms for 4 (transfer 0x5556238fac10)
>> * Connected to localhost (::1) port 80 (#0)
>>> GET / HTTP/1.1
>>> Host:4.DOMAIN.edu.ar [1]
>>> User-Agent: curl/7.64.0
>>> Accept: */*
>>>
>> < HTTP/1.1 301 Moved Permanently
>> < Date: Tue, 21 Sep 2021 22:13:01 GMT
>> < Server: Apache/2.4.48
>> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
>> < X-Redirect-By: WordPress
>> < Location: https://1.DOMAIN.edu.ar/
>> < Content-Length: 0
>> < Content-Type: text/html; charset=UTF-8
>> <
>> * Connection #0 to host localhost left intact
>>
>> From apachectl -S I see the problem is related to what vhost is set
>> as
>> default
>> VirtualHost configuration:
>> *:80 is a NameVirtualHost
>> default server 4.DOMAIN.edu.ar [1]
>> (/etc/apache2/sites-enabled/1.DOMAIN.conf:1)
>> port 80 namevhost 4.DOMAIN.edu.ar [1]
>> (/etc/apache2/sites-enabled/1.DOMAIN.conf:1)
>> alias 1.DOMAIN.edu.ar [2]
>> port 80 namevhost 4.DOMAIN.edu.ar [1]
>> (/etc/apache2/sites-enabled/2.DOMAIN.conf:1)
>> alias 2.DOMAIN.edu.ar [3]
>> port 80 namevhost 4.DOMAIN.edu.ar [1]
>> (/etc/apache2/sites-enabled/4.DOMAIN.conf:1)
>> alias 4.DOMAIN.edu.ar [1]
>> port 80 namevhost 4.DOMAIN.edu.ar [1]
>> (/etc/apache2/sites-enabled/3.DOMAIN.conf:1)
>> alias 3.DOMAIN.unau.edu.ar [4]
>> ServerRoot: "/etc/apache2"
>> Main DocumentRoot: "/var/www/html"
>> Main ErrorLog: "/var/log/apache2/error.log"
>> Mutex ssl-stapling: using_defaults
>> Mutex ssl-cache: using_defaults
>> Mutex default: dir="/var/run/apache2/" mechanism=default
>> Mutex mpm-accept: using_defaults
>> Mutex watchdog-callback: using_defaults
>> Mutex rewrite-map: using_defaults
>> Mutex ssl-stapling-refresh: 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
>>
>> El 2021-09-21 18:48, Frank Gingras escribió:
>>> Show the httpd -S output and results from your tests with curl,
>> then.
>>>
>>> It might help to log the host: header in your access log too.
>>>
>>> On Tue, 21 Sept 2021 at 17:41, Daniel Armando Rodriguez
>>> <drodriguez@unau.edu.ar.invalid> wrote:
>>>
>>>> Changed all vhosts definition the way you suggested, but the
>> issue
>>>> still
>>>> happens.
>>>>
>>>> El 2021-09-21 16:32, Frank Gingras escribió:
>>>>> The first mistake is to use the hostnames when defining vhosts.
>>>> Define
>>>>> them all as *:PORT, then test with curl, and run apachectl -S or
>>>> httpd
>>>>> -S to spot any overlap.
>>>>>
>>>>> On Tue, 21 Sept 2021 at 14:48, Daniel Armando Rodriguez
>>>>> <drodriguez@unau.edu.ar.invalid> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have four subdomains on the same host which work as expected
>>>> whis
>>>>>> this
>>>>>> base config
>>>>>>
>>>>>> <VirtualHost 4.DOMAIN.edu.ar:80 [5] [1] [1]>
>>>>>>
>>>>>> ServerName 4.DOMAIN.edu.ar [1] [2] [2]
>>>>>> ServerAlias 4.DOMAIN.edu.ar [1] [2] [2]
>>>>>> ServerAdmin webmaster@DOMAIN.edu.ar
>>>>>>
>>>>>> DocumentRoot /var/www/4
>>>>>>
>>>>>> <Directory "/var/www/4">
>>>>>> Options FollowSymLinks
>>>>>> AllowOverride All
>>>>>> Require all granted
>>>>>> </Directory>
>>>>>>
>>>>>> ErrorLog ${APACHE_LOG_DIR}/error_4.log
>>>>>> CustomLog ${APACHE_LOG_DIR}/access_4.log combined
>>>>>>
>>>>>> </VirtualHost>
>>>>>>
>>>>>> In the particular case of fourth subdomain, gets redirected to
>>>> the
>>>>>> first. See
>>>>>>
>>>>>> # curl -v -H Host:4.DOMAIN.edu.ar [1] [2] [2]
>> http://INTERNAL-IP/
>>>>>> * Expire in 0 ms for 6 (transfer 0x55669ac96c10)
>>>>>> * Trying INTERNAL-IP...
>>>>>> * TCP_NODELAY set
>>>>>> * Expire in 200 ms for 4 (transfer 0x55669ac96c10)
>>>>>> * Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
>>>>>>> GET / HTTP/1.1
>>>>>>> Host:4.DOMAIN.edu.ar [1] [2] [2]
>>>>>>> User-Agent: curl/7.64.0
>>>>>>> Accept: */*
>>>>>>>
>>>>>> < HTTP/1.1 301 Moved Permanently
>>>>>> < Date: Tue, 21 Sep 2021 18:32:32 GMT
>>>>>> < Server: Apache/2.4.48
>>>>>> < X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
>>>>>> < X-Redirect-By: WordPress
>>>>>> < Location: https://1.DOMAIN.edu.ar/
>>>>>> < Content-Length: 0
>>>>>> < Content-Type: text/html; charset=UTF-8
>>>>>> <
>>>>>> * Connection #0 to host INTERNAL-IP left intact
>>>>>>
>>>>>> As said, domains 1, 3 and 3 works. In fact, when configuring
>> the
>>>> 4th
>>>>>>
>>>>>> just copied the one of the working configs and changed the
>>>>>> subdomain,
>>>>>> directory and also the log. Nothing more, but the result is not
>>>> the
>>>>>> one
>>>>>> I expected.
>>>>>>
>>>>>> Any hint will be much appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Four subdomain, fourth redirects to first [ In reply to ]
On 9/21/21 18:52, Frank Gingras wrote:
> I would not rely on the debian scripts. Looking at apachectl -S will tell
> you what you need to know.
>
> On Tue, 21 Sept 2021 at 18:51, Frank Gingras <thumbs@apache.org> wrote:
>
>> Why do you have two vhosts with the same ServerName value set? That will


Off topic question : WHY DO YOU PEOPLE TOP POST ?



--
Dennis Clarke (free/like/beer)
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org