You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Niklas Saers Mailinglistaccount <ni...@doriath.saers.com> on 2003/06/03 10:38:54 UTC

Apache/mod_jk/Tomcat 404-problem

Hi,
I'm running a webserver with many virtual hosts. The default virtualhost
is the registrar.no virtualhost that has a serveralias to www.registrar.no

I issue the following requests:
http://registrar.no/servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper
http://www.registrar.no/servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper
http://192.168.1.10/servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper

In my logfile I get:

192.168.0.44 - - [03/Jun/2003:10:28:14 +0200] "GET /servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper HTTP/1.1" 404 839 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
192.168.0.44 - - [03/Jun/2003:10:28:19 +0200] "GET /servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper HTTP/1.1" 404 839 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
192.168.0.44 - - [03/Jun/2003:10:28:40 +0200] "GET /servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper HTTP/1.1" 200 0 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"

Why do I get a 404 on the two first ones while I get a 200 on the last?
The 404 is generated by Tomcat, so it's obvious that Tomcat kicks in.
While the AJP runs on port 11143, I have a HTTP server instance (from the
same server.xml file) running on port 41143. When I do

http://registrar.no:41143/servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper
http://www.registrar.no:41143/servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper
http://192.168.1.10:41143/servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper

they all produce the correct output.

My server is Apache/2.0.46 (Unix) DAV/2 mod_jk2/2.0.3-dev PHP/4.3.1
mod_python/3.0.3 Python/2.2.2 mod_ssl/2.0.46 OpenSSL/0.9.7a with Tomcat
4.1.24

My virtualhost is:

<VirtualHost *:80>
  ServerAdmin webmaster@registrar.no
  ServerName registrar.no
  ServerAlias *.registrar.no
  DocumentRoot /home/no/regis_7
  CustomLog /var/log/weblogs/registrar.no/access_log combined
  ErrorLog /var/log/weblogs/registrar.no/error_log
  <Directory /home/no/regis_7>
    Options ExecCGI Includes
    RLimitCPU 5 5
    RLimitMEM 6000000 6000000
    RLimitNPROC 10 10
  </Directory>
  <Location />
    php_admin_value doc_root /home/no/regis_7/
    php_admin_value user_dir /home/no/regis_7/
    php_admin_value open_basedir "/home/no/regis_7/:/usr/local/lib/php/"
    php_admin_value error_log /var/log/weblogs/registrar.no/php_error
    php_admin_value register_globals On
    php_admin_value upload_tmp_dir /home/no/regis_7/tmp
    php_admin_value from webmaster@registrar.no
    php_admin_value safe_mode Off
  </Location>
  SuexecUserGroup regis_7 ftpchroot

  <Location "/*.jsp">
    JkUriSet worker ajp13:localhost:11143
  </Location>

  <Location "/webapps">
    JkUriSet worker ajp13:localhost:11143
  </Location>

  <Location "/servlet">
    JkUriSet worker ajp13:localhost:11143
  </Location>

  <Location "/servlets/*">
    JkUriSet worker ajp13:localhost:11143
  </Location>

</VirtualHost>

Thanks in advance for helping me figuring out this 404.

Cheers

  Nik

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Apache/mod_jk/Tomcat 404-problem

Posted by John Turner <to...@johnturner.com>.
On Wed, 4 Jun 2003 11:07:30 +0200 (CEST), Niklas Saers Mailinglistaccount 
<ni...@doriath.saers.com> wrote:

>> First thing I would do is drop the wildcard from ServerAlias.  There's a
>> very good chance that's an Apache thing...that doesn't necessarily mean
>> that Tomcat accepts it.
>
> Right. Is there any way of figuring out whether Tomcat accepts it? Either
> way, it seemed to respond equally to requests that were called through 
> the
> alias and through the servername

Not that I know of, short of checking the source or asking on tomcat-dev.

>> Since your Tomcat instance serves all the requests correctly, the 
>> culprit
>> is Apache not passing the correct host header to Tomcat (or rather, the
>> host header that Tomcat needs to see).  This may or may not be a mod_jk
>> issue, too.
>
> First thing I did was to have a chat with the Apache folks, and they
> recommended I had a chat with the mod_jk2 crew as they could not find any
> problems.
>
> Is there any way I can monitor what headers are sent to mod_jk2 and what
> headers are sent from mod_jk2?

Not that I know of...the "debug" level for JK logging doesn't list the host 
headers, as far as I know.  I guess you could always tweak the JK/JK2 
source to do so, and compile your own version...shouldn't be too difficult. 
 The other thing would be to check Tomcat's logs when requests come 
in...Tomcat should log 404s, etc. just as Apache does, along with the 
request URI.

Someone else may have better suggestions.  I don't use JK2, but AFAIK name- 
based virtual hosting works...I know it works with JK.

John

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Apache/mod_jk/Tomcat 404-problem

Posted by Niklas Saers Mailinglistaccount <ni...@doriath.saers.com>.
Hi John, and thanks for taking your time to help me :)

> First thing I would do is drop the wildcard from ServerAlias.  There's a
> very good chance that's an Apache thing...that doesn't necessarily mean
> that Tomcat accepts it.

Right. Is there any way of figuring out whether Tomcat accepts it? Either
way, it seemed to respond equally to requests that were called through the
alias and through the servername

> Since your Tomcat instance serves all the requests correctly, the culprit
> is Apache not passing the correct host header to Tomcat (or rather, the
> host header that Tomcat needs to see).  This may or may not be a mod_jk
> issue, too.

First thing I did was to have a chat with the Apache folks, and they
recommended I had a chat with the mod_jk2 crew as they could not find any
problems.

Is there any way I can monitor what headers are sent to mod_jk2 and what
headers are sent from mod_jk2?

> Also, do you have Apache's NameVirtualHost directive enabled?

Yes, I do. :)

Cheers

  Nik

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Apache/mod_jk/Tomcat 404-problem

Posted by John Turner <to...@johnturner.com>.
First thing I would do is drop the wildcard from ServerAlias.  There's a 
very good chance that's an Apache thing...that doesn't necessarily mean 
that Tomcat accepts it.

Since your Tomcat instance serves all the requests correctly, the culprit 
is Apache not passing the correct host header to Tomcat (or rather, the 
host header that Tomcat needs to see).  This may or may not be a mod_jk 
issue, too.

Also, do you have Apache's NameVirtualHost directive enabled?

John

On Tue, 3 Jun 2003 10:38:54 +0200 (CEST), Niklas Saers Mailinglistaccount 
<ni...@doriath.saers.com> wrote:

> Hi,
> I'm running a webserver with many virtual hosts. The default virtualhost
> is the registrar.no virtualhost that has a serveralias to 
> www.registrar.no
>
> I issue the following requests:
> http://registrar.no/servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper 
>
>
> http://www.registrar.no/servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper 
>
>
> http://192.168.1.10/servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper
>
> In my logfile I get:
>
> 192.168.0.44 - - [03/Jun/2003:10:28:14 +0200] "GET 
> /servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper HTTP/1.1" 404 
> 839 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
> 192.168.0.44 - - [03/Jun/2003:10:28:19 +0200] "GET 
> /servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper HTTP/1.1" 404 
> 839 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
> 192.168.0.44 - - [03/Jun/2003:10:28:40 +0200] "GET 
> /servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper HTTP/1.1" 200 
> 0 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
>
> Why do I get a 404 on the two first ones while I get a 200 on the last?
> The 404 is generated by Tomcat, so it's obvious that Tomcat kicks in.
> While the AJP runs on port 11143, I have a HTTP server instance (from the
> same server.xml file) running on port 41143. When I do
>
> http://registrar.no:41143/servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper 
>
>
> http://www.registrar.no:41143/servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper 
>
>
> http://192.168.1.10:41143/servlets/servlet/no.registrar.servlets.LagEndreDnsKnapper
>
> they all produce the correct output.
>
> My server is Apache/2.0.46 (Unix) DAV/2 mod_jk2/2.0.3-dev PHP/4.3.1
> mod_python/3.0.3 Python/2.2.2 mod_ssl/2.0.46 OpenSSL/0.9.7a with Tomcat
> 4.1.24
>
> My virtualhost is:
>
> <VirtualHost *:80>
> ServerAdmin webmaster@registrar.no
> ServerName registrar.no
> ServerAlias *.registrar.no
> DocumentRoot /home/no/regis_7
> CustomLog /var/log/weblogs/registrar.no/access_log combined
> ErrorLog /var/log/weblogs/registrar.no/error_log
> <Directory /home/no/regis_7>
> Options ExecCGI Includes
> RLimitCPU 5 5
> RLimitMEM 6000000 6000000
> RLimitNPROC 10 10
> </Directory>
> <Location />
> php_admin_value doc_root /home/no/regis_7/
> php_admin_value user_dir /home/no/regis_7/
> php_admin_value open_basedir "/home/no/regis_7/:/usr/local/lib/php/"
> php_admin_value error_log /var/log/weblogs/registrar.no/php_error
> php_admin_value register_globals On
> php_admin_value upload_tmp_dir /home/no/regis_7/tmp
> php_admin_value from webmaster@registrar.no
> php_admin_value safe_mode Off
> </Location>
> SuexecUserGroup regis_7 ftpchroot
>
> <Location "/*.jsp">
> JkUriSet worker ajp13:localhost:11143
> </Location>
>
> <Location "/webapps">
> JkUriSet worker ajp13:localhost:11143
> </Location>
>
> <Location "/servlet">
> JkUriSet worker ajp13:localhost:11143
> </Location>
>
> <Location "/servlets/*">
> JkUriSet worker ajp13:localhost:11143
> </Location>
>
> </VirtualHost>
>
> Thanks in advance for helping me figuring out this 404.
>
> Cheers
>
> Nik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org