Discussion:
Virtual Host Alias ignored?
Jeff Wild
2012-08-29 16:09:24 UTC
Permalink
Tomcat 6 (standalone), several virtual hosts



I have a A record for mydomain.com and a CNAME record for
www.mydomain.com.

When I enter domain.com in my browser, everything works fine but
www.domain.com results in "Server not found."



1. Is my configuration correct when no https is required?

2. Is it possible there's a DNS issue?



<Connector

address="192.168.100.98"

port="80"

protocol="HTTP/1.1"

connectionTimeout="20000"

useIPVHosts="true" />



...



<Host

name="mydomain.com"

appBase="/home/websites/mydomain.com/webapps"

unpackWARs="true"

autoDeploy="true">

<Alias>192.168.100.98</Alias>

<Alias>www.mydomain.com</Alias>

<Valve


className="org.apache.catalina.valves.AccessLogValve"

directory="/home/websites/mydomain.com/logs"

prefix="mydomain.com_access"

suffix=".log"

pattern="common"

resolveHosts="false" />

</Host>



This only seems to be a problem when there is no https configured for
the host (Connector reconnectPort attribute is not specified.) For
example, this works fine:



<Connector

address="192.168.100.99"

port="80"

protocol="HTTP/1.1"

connectionTimeout="20000"

redirectPort="443"

useIPVHosts="true" />



<Connector

address="192.168.100.99"

port="443"

useIPVHosts="true"

protocol="org.apache.coyote.http11.Http11Protocol"

SSLEnabled="true"

maxThreads="150"

scheme="https"

secure="true"

clientAuth="false"

sslProtocol="TLS"

ciphers="SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA,
TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA,
SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA"

keystoreType="PKCS12"

keystoreFile="/certs/www.anotherDomain.com.pkcs12"

keystorePass="password" />



<Host

name="anotherDomain.com"

appBase="/home/websites/anotherDomain.com/webapps"

unpackWARs="true"

autoDeploy="true">

<Alias>www.anotherDomain.com</Alias>

<Alias>anotherDomain.com</Alias>

<Alias>192.168.100.99</Alias>

<Valve


className="org.apache.catalina.valves.AccessLogValve"

directory="/home/websites/anotherDomain.com/logs"

prefix="anotherDomain.com_access."

suffix=".log"

pattern="common"

resolveHosts="false" />

</Host>
Konstantin Kolinko
2012-08-29 16:48:50 UTC
Permalink
Post by Jeff Wild
Tomcat 6 (standalone), several virtual hosts
I have a A record for mydomain.com and a CNAME record for
www.mydomain.com.
When I enter domain.com in my browser, everything works fine but
www.domain.com results in "Server not found."
1. Is my configuration correct when no https is required?
2. Is it possible there's a DNS issue?
<Connector
address="192.168.100.98"
port="80"
protocol="HTTP/1.1"
connectionTimeout="20000"
useIPVHosts="true" />
<Alias> is just a textual string that is matched against data sent by
incoming HTTP request. No DNS lookup happens at Tomcat side.

Your useIPVHosts="true" effectively disables host name matching.
(Target IP address of incoming request will be used instead of the
value of the "Host" header).
Jeff Wild
2012-08-29 20:24:47 UTC
Permalink
-----Original Message-----
From: Konstantin Kolinko [mailto:***@gmail.com]
Sent: Wednesday, August 29, 2012 11:49 AM
To: Tomcat Users List
Subject: Re: Virtual Host Alias ignored?
Post by Jeff Wild
Tomcat 6 (standalone), several virtual hosts
I have a A record for mydomain.com and a CNAME record for
www.mydomain.com.
When I enter domain.com in my browser, everything works fine but
www.domain.com results in "Server not found."
1. Is my configuration correct when no https is required?
2. Is it possible there's a DNS issue?
<Connector
address="192.168.100.98"
port="80"
protocol="HTTP/1.1"
connectionTimeout="20000"
useIPVHosts="true" />
<Alias> is just a textual string that is matched against data sent by
incoming HTTP request. No DNS lookup happens at Tomcat side.

Your useIPVHosts="true" effectively disables host name matching.
(Target IP address of incoming request will be used instead of the
value of the "Host" header).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org

Granted, so if my DNS is set up correctly (www.mydomain.com CNAME points
to mydomain.com) then requests to www.mydomain.com should appear to
tomcat as coming from the same IP as mydomain.com. So why isn't this
working? Something wrong with my configuration?
Konstantin Kolinko
2012-08-29 21:18:14 UTC
Permalink
Post by Jeff Wild
-----Original Message-----
Sent: Wednesday, August 29, 2012 11:49 AM
To: Tomcat Users List
Subject: Re: Virtual Host Alias ignored?
Post by Jeff Wild
Tomcat 6 (standalone), several virtual hosts
I have a A record for mydomain.com and a CNAME record for
www.mydomain.com.
When I enter domain.com in my browser, everything works fine but
www.domain.com results in "Server not found."
1. Is my configuration correct when no https is required?
2. Is it possible there's a DNS issue?
<Connector
address="192.168.100.98"
port="80"
protocol="HTTP/1.1"
connectionTimeout="20000"
useIPVHosts="true" />
<Alias> is just a textual string that is matched against data sent by
incoming HTTP request. No DNS lookup happens at Tomcat side.
Your useIPVHosts="true" effectively disables host name matching.
(Target IP address of incoming request will be used instead of the
value of the "Host" header).
Granted, so if my DNS is set up correctly (www.mydomain.com CNAME points
to mydomain.com) then requests to www.mydomain.com should appear to
tomcat as coming from the same IP as mydomain.com. So why isn't this
working?
1. I suppose you mean "to the same IP" instead of "from the same IP".

2. Tomcat does not care what your DNS server knows. It does not care
what names match to what addresses. It operates on data received in
an HTTP request.

Do you know how HTTP protocol operates?

3. useIPVHosts="true" vs useIPVHosts="false" are two substantially
different modes of operation
Post by Jeff Wild
Something wrong with my configuration?
Well, it works. But it does not do what you wanted.

Best regards,
Konstantin Kolinko
Jeff Wild
2012-08-30 12:12:10 UTC
Permalink
-----Original Message-----
From: Konstantin Kolinko [mailto:***@gmail.com]
Sent: Wednesday, August 29, 2012 4:18 PM
To: Tomcat Users List
Subject: Re: Virtual Host Alias ignored?
Post by Jeff Wild
-----Original Message-----
Sent: Wednesday, August 29, 2012 11:49 AM
To: Tomcat Users List
Subject: Re: Virtual Host Alias ignored?
Post by Jeff Wild
Tomcat 6 (standalone), several virtual hosts
I have a A record for mydomain.com and a CNAME record for
www.mydomain.com.
When I enter domain.com in my browser, everything works fine but
www.domain.com results in "Server not found."
1. Is my configuration correct when no https is required?
2. Is it possible there's a DNS issue?
<Connector
address="192.168.100.98"
port="80"
protocol="HTTP/1.1"
connectionTimeout="20000"
useIPVHosts="true" />
<Alias> is just a textual string that is matched against data sent by
incoming HTTP request. No DNS lookup happens at Tomcat side.
Your useIPVHosts="true" effectively disables host name matching.
(Target IP address of incoming request will be used instead of the
value of the "Host" header).
Granted, so if my DNS is set up correctly (www.mydomain.com CNAME
points
Post by Jeff Wild
to mydomain.com) then requests to www.mydomain.com should appear to
tomcat as coming from the same IP as mydomain.com. So why isn't this
working?
1. I suppose you mean "to the same IP" instead of "from the same IP".

2. Tomcat does not care what your DNS server knows. It does not care
what names match to what addresses. It operates on data received in
an HTTP request.

Do you know how HTTP protocol operates?

3. useIPVHosts="true" vs useIPVHosts="false" are two substantially
different modes of operation
Post by Jeff Wild
Something wrong with my configuration?
Well, it works. But it does not do what you wanted.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
You must derive a great deal of pleasure from helping people.
Christopher Schultz
2012-08-30 14:20:59 UTC
Permalink
Jeff,
Post by Jeff Wild
I have a A record for mydomain.com and a CNAME record for
www.mydomain.com.
When I enter domain.com in my browser, everything works fine but
www.domain.com results in "Server not found."
Did you register www.domain.com, too, and set up A/CNAME records for
it? Or was that a typo?
Post by Jeff Wild
<Connector address="192.168.100.98"
You are binding to an interface which is communicating using a
non-routable IP segment, so unless this is within some kind of
segmented network with a NAT out front, you'll never be able to reach
it from the outside.
Post by Jeff Wild
This only seems to be a problem when there is no https configured
for the host (Connector reconnectPort attribute is not specified.)
<Connector address="192.168.100.99"
This is a different IP address. Do you have two separate interfaces on
your server, or is this two different servers?
Post by Jeff Wild
redirectPort="443"
<Connector address="192.168.100.99" port="443"
Does your webapp specify that it must use CONFIDENTIAL communication?
If so, you are probably being redirected to https://www.mydomain.com/
and if you don't have an HTTPS connector, the client won't be able to
connect.

Can you sniff the HTTP conversation from the client end? You may be
being redirected -- you just don't know it.

- -chris

Continue reading on narkive:
Loading...