You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Alan Chandler <al...@chandlerfamily.org.uk> on 2007/08/22 22:31:42 UTC

[users@httpd] Strange interaction between mod_rewrite and mod_jk

I am running Debian Etch Apache2 with Tomcat backending it connected via 
the standard Debian libapache2-mod-jk package.

Something has happened (a Debian upgrade maybe) that has made it stop 
working properly. It has been working

Accessing http://www.chandlerfamily.org.uk hangs with no reply

whilst the url that it is re-written to 
 http://www.chandlerfamily.org.uk/blog/app 

works fine if you enter it manually.

The site is one of several virtual hosts based around IP addressing 
(from inside and outside my house)

My basic structure is two files, one included via the 
Debian "sites-enabled" facility and the other included from it.

the first file defines the virtual hosts, and their rewrite rule to 
determine the home page, the second is all the common directives.

so the first is like this (this is a subset of the file)

<VirtualHost  home.chandlerfamily.org.uk:80 >

        Include /etc/apache2/sites-available/www-common
        RewriteRule ^/$ /blog/app       [PT]

        RewriteLog      /var/log/apache2/rewrite.log
        RewriteLogLevel 0

</VirtualHost>

<VirtualHost 192.168.0.32:80 >
#money.home

        Include /etc/apache2/sites-available/www-common
        RewriteRule     ^/$ /akcmoney/app       [PT]
</VirtualHost>

-------------------------------------------------------
the included file starts like this


        ServerName www.chandlerfamily.org.uk

        DocumentRoot /var/www/chandlerfamily

# define which URLs get passed to tomcat
        JkMount         /blog/* tomcat

...
-------------------------------------------------------

I increase the RewriteLogLevel to 2 and it is rewriting the null url to 
the required thing (if you can see this, with linewraping form my mail 
program) 

158.234.250.71 - - [22/Aug/2007:16:31:29 +0100] 
[www.chandlerfamily.org.uk/sid#83d7940][rid#860ee88/initial] (2) init 
rewrite eng
ine with requested uri /
158.234.250.71 - - [22/Aug/2007:16:31:29 +0100] 
[www.chandlerfamily.org.uk/sid#83d7940][rid#860ee88/initial] (2) 
rewrite '/' -> '
/blog/app'
158.234.250.71 - - [22/Aug/2007:16:31:29 +0100] 
[www.chandlerfamily.org.uk/sid#83d7940][rid#860ee88/initial] (2) 
forcing '/blog/a
pp' to get passed through to next API URI-to-filename handler



and my access log shows that url being accessed, but no other evidence.

Can anyone see what I am doing wrong, or how I could debug it




-- 
Alan Chandler
http://www.chandlerfamily.org.uk


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Strange interaction between mod_rewrite and mod_jk

Posted by Alan Chandler <al...@chandlerfamily.org.uk>.
On Monday 27 Aug 2007, Frank Arensmeier wrote:
> Hello Alan.
>
> First I might say that I've never worked with Tomtact. However,
> looking at the response from your server (which is "HTTP/1.x 400 No
> Host matches server name www.chandlerfamily.org.uk") you might get
> some ideas here:
>

Can someone explain what that means - www.chandlerfamily.org.uk has a 
well defined ip address on the internet, and I have a virtual host (see 
below) with that ip address in. 

Is apache trying to do named virtual host lookup instead of an ip one?


> http://www.nabble.com/context-path-ignored-in-Context.xml-t1175121.ht
>ml http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
>



Its been a while, because I have been busy with other things, but I 
looked at this.

This is purely about the path to the application, and since it works 
fine when I explicity put the path in, I don't think that is the issue.

I am wondering if when I rewrite, I need to do something with the host 
name.








> Or just google for the error response message.
>
> //frank
>
> 27 aug 2007 kl. 08.49 skrev Alan Chandler:
> > On Wednesday 22 Aug 2007, Alan Chandler wrote:
> >> I am running Debian Etch Apache2 with Tomcat backending it
> >> connected via the standard Debian libapache2-mod-jk package.
> >>
> >> Something has happened (a Debian upgrade maybe) that has made it
> >> stop working properly. It has been working
> >>
> >> Accessing http://www.chandlerfamily.org.uk hangs with no reply
> >>
> >> whilst the url that it is re-written to
> >>  http://www.chandlerfamily.org.uk/blog/app
> >
> > Nobody did ever reply to this post when I made it last week.  I
> > have since made some changes to some of the files to try and
> > highlight the problem, and perhaps correct a few things but nothing
> > has worked.
> >
> > I could really do with advice as to what is wrong, or how to get
> > more information so I cna find out what is wrong.
> >
> > Putting RewriteLogLevel to 2 in the first Virtual Host shows that
> > the rewrite is happening.
> >
> > It is worth saying that Debian Default site adds a
> >
> > NameVirtualHost	*
> >
> > directive in.  It seems to make no difference if that is there or
> > not.
> >
> > Here is the key config file (83.43.22.1 is my external ip address)
> >
> > -----------------------------------------------------
> >
> >
> > <VirtualHost  82.43.77.1:80 >
> >
> >         ServerName      www.chandlerfamily.org.uk
> >         Include /etc/apache2/sites-available/www-common
> >         RewriteRule ^/$ /blog/app       [PT]
> >
> >         RewriteLog      /var/log/apache2/rewrite.log
> >         RewriteLogLevel 0
> >
> > </VirtualHost>
> >
> > <VirtualHost 192.168.0.32:80 >
> > #money.home
> >
> >         ServerName money.home
> >         Include /etc/apache2/sites-available/www-common
> >         RewriteRule     ^/$ /akcmoney/app       [PT]
> > </VirtualHost>
> >
> > <VirtualHost 192.168.0.30:80 >
> > #webmail.home
> >         ServerName      webmail.home
> >         DirectoryIndex /cgi-bin/sqwebmail
> >         Include /etc/apache2/sites-available/www-common
> > </VirtualHost>
> >
> > <VirtualHost 192.168.0.30:443 82.43.77.1:443>
> >
> >         ServerName      www.chandlerfamily.org.uk
> >
> >         SSLEngine       on
> > #       SSLProtocol     all
> > #       SSLCipherSuite  all
> >
> > #       SSLCACertificateFile    /etc/apache2/ssl/ca.crt
> >         SSLCertificateFile      /etc/apache2/ssl/server.crt
> >         SSLCertificateKeyFile   /etc/apache2/ssl/server.key
> >
> >
> >         Include /etc/apache2/sites-available/www-common
> >         RewriteRule ^/$ /blog/app       [PT]
> > </VirtualHost>
> >
> >         SSLSessionCache dbm:/var/cache/apache2/SSLSessionCache
> >         SSLSessionCacheTimeout 600
> >
> > ------------------------------------------------------------------
> >
> > As you can see, www-common is included as it contains all the key
> > directives for the site. Here is key part of it
> > -----------------------------------------------------------------
> >
> >         DocumentRoot /var/www/chandlerfamily
> >
> > # define which URLs get passed to tomcat
> >         JkMount         /blog/* tomcat
> >         JkMount         /akcmoney/* tomcat
> >         JkMount         /moneydemo/* tomcat
> >         JkMount         /usermgr/* tomcat
> >         JkMount         /famtree/* tomcat
> >
> >         RewriteEngine   on
> > #   Force clients from the Internet to use HTTPS
> >         RewriteCond     %{REMOTE_ADDR} !^192\.168\.0\.2[1-6]$
> >         RewriteCond     %{HTTPS} !=on
> >         RewriteRule     ^/akcmoney/.* - [F]
> >
> >         RewriteCond     %{REMOTE_ADDR} !^192\.168\.0\.2[0-6]$
> >         RewriteRule     ^/manager/.* - [F]
> >
> >         RewriteCond     %{REMOTE_ADDR} !^192\.168\.0\.2[0-6]$
> >         RewriteCond     %{HTTPS} !=on
> >         RewriteRule     ^/files/secure/.* - [F]
> >
> > # Break this file up by security Areas
> > #[SECURITY] Open
> >
> >         <Directory /var/www/chandlerfamily>
> >                 Order           allow,deny
> >                 Allow           from all
> >                 Options FollowSymLinks MultiViews
> >         </Directory>
> >
> > # Protect underlying git repository from access
> >         <Directory /var/www/chandlerfamily/.git>
> >                 Order   deny,allow
> >                 Deny    from all
> >         </Directory>
> >
> >        CustomLog /var/log/apache2/www.log simple
> >
> >
> >
> > --
> > Alan Chandler
> > http://www.chandlerfamily.org.uk
> >
> >
> > -------------------------------------------------------------------
> >-- The official User-To-User support forum of the Apache HTTP Server
> > Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org



-- 
Alan Chandler
http://www.chandlerfamily.org.uk


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Strange interaction between mod_rewrite and mod_jk

Posted by Frank Arensmeier <fr...@nikehydraulics.se>.
Hello Alan.

First I might say that I've never worked with Tomtact. However,  
looking at the response from your server (which is "HTTP/1.x 400 No  
Host matches server name www.chandlerfamily.org.uk") you might get  
some ideas here:

http://www.nabble.com/context-path-ignored-in-Context.xml-t1175121.html
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

Or just google for the error response message.

//frank

27 aug 2007 kl. 08.49 skrev Alan Chandler:

> On Wednesday 22 Aug 2007, Alan Chandler wrote:
>> I am running Debian Etch Apache2 with Tomcat backending it connected
>> via the standard Debian libapache2-mod-jk package.
>>
>> Something has happened (a Debian upgrade maybe) that has made it stop
>> working properly. It has been working
>>
>> Accessing http://www.chandlerfamily.org.uk hangs with no reply
>>
>> whilst the url that it is re-written to
>>  http://www.chandlerfamily.org.uk/blog/app
>>
>
> Nobody did ever reply to this post when I made it last week.  I have
> since made some changes to some of the files to try and highlight the
> problem, and perhaps correct a few things but nothing has worked.
>
> I could really do with advice as to what is wrong, or how to get more
> information so I cna find out what is wrong.
>
> Putting RewriteLogLevel to 2 in the first Virtual Host shows that the
> rewrite is happening.
>
> It is worth saying that Debian Default site adds a
>
> NameVirtualHost	*
>
> directive in.  It seems to make no difference if that is there or not.
>
> Here is the key config file (83.43.22.1 is my external ip address)
>
> -----------------------------------------------------
>
>
> <VirtualHost  82.43.77.1:80 >
>
>         ServerName      www.chandlerfamily.org.uk
>         Include /etc/apache2/sites-available/www-common
>         RewriteRule ^/$ /blog/app       [PT]
>
>         RewriteLog      /var/log/apache2/rewrite.log
>         RewriteLogLevel 0
>
> </VirtualHost>
>
> <VirtualHost 192.168.0.32:80 >
> #money.home
>
>         ServerName money.home
>         Include /etc/apache2/sites-available/www-common
>         RewriteRule     ^/$ /akcmoney/app       [PT]
> </VirtualHost>
>
> <VirtualHost 192.168.0.30:80 >
> #webmail.home
>         ServerName      webmail.home
>         DirectoryIndex /cgi-bin/sqwebmail
>         Include /etc/apache2/sites-available/www-common
> </VirtualHost>
>
> <VirtualHost 192.168.0.30:443 82.43.77.1:443>
>
>         ServerName      www.chandlerfamily.org.uk
>
>         SSLEngine       on
> #       SSLProtocol     all
> #       SSLCipherSuite  all
>
> #       SSLCACertificateFile    /etc/apache2/ssl/ca.crt
>         SSLCertificateFile      /etc/apache2/ssl/server.crt
>         SSLCertificateKeyFile   /etc/apache2/ssl/server.key
>
>
>         Include /etc/apache2/sites-available/www-common
>         RewriteRule ^/$ /blog/app       [PT]
> </VirtualHost>
>
>         SSLSessionCache dbm:/var/cache/apache2/SSLSessionCache
>         SSLSessionCacheTimeout 600
>
> ------------------------------------------------------------------
>
> As you can see, www-common is included as it contains all the key
> directives for the site. Here is key part of it
> -----------------------------------------------------------------
>
>         DocumentRoot /var/www/chandlerfamily
>
> # define which URLs get passed to tomcat
>         JkMount         /blog/* tomcat
>         JkMount         /akcmoney/* tomcat
>         JkMount         /moneydemo/* tomcat
>         JkMount         /usermgr/* tomcat
>         JkMount         /famtree/* tomcat
>
>         RewriteEngine   on
> #   Force clients from the Internet to use HTTPS
>         RewriteCond     %{REMOTE_ADDR} !^192\.168\.0\.2[1-6]$
>         RewriteCond     %{HTTPS} !=on
>         RewriteRule     ^/akcmoney/.* - [F]
>
>         RewriteCond     %{REMOTE_ADDR} !^192\.168\.0\.2[0-6]$
>         RewriteRule     ^/manager/.* - [F]
>
>         RewriteCond     %{REMOTE_ADDR} !^192\.168\.0\.2[0-6]$
>         RewriteCond     %{HTTPS} !=on
>         RewriteRule     ^/files/secure/.* - [F]
>
> # Break this file up by security Areas
> #[SECURITY] Open
>
>         <Directory /var/www/chandlerfamily>
>                 Order           allow,deny
>                 Allow           from all
>                 Options FollowSymLinks MultiViews
>         </Directory>
>
> # Protect underlying git repository from access
>         <Directory /var/www/chandlerfamily/.git>
>                 Order   deny,allow
>                 Deny    from all
>         </Directory>
>
>        CustomLog /var/log/apache2/www.log simple
>
>
>
> -- 
> Alan Chandler
> http://www.chandlerfamily.org.uk
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server  
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Strange interaction between mod_rewrite and mod_jk

Posted by Alan Chandler <al...@chandlerfamily.org.uk>.
On Wednesday 22 Aug 2007, Alan Chandler wrote:
> I am running Debian Etch Apache2 with Tomcat backending it connected
> via the standard Debian libapache2-mod-jk package.
>
> Something has happened (a Debian upgrade maybe) that has made it stop
> working properly. It has been working
>
> Accessing http://www.chandlerfamily.org.uk hangs with no reply
>
> whilst the url that it is re-written to
>  http://www.chandlerfamily.org.uk/blog/app
>

Nobody did ever reply to this post when I made it last week.  I have 
since made some changes to some of the files to try and highlight the 
problem, and perhaps correct a few things but nothing has worked.

I could really do with advice as to what is wrong, or how to get more 
information so I cna find out what is wrong.

Putting RewriteLogLevel to 2 in the first Virtual Host shows that the 
rewrite is happening.

It is worth saying that Debian Default site adds a

NameVirtualHost	*

directive in.  It seems to make no difference if that is there or not.

Here is the key config file (83.43.22.1 is my external ip address)

-----------------------------------------------------


<VirtualHost  82.43.77.1:80 >

        ServerName      www.chandlerfamily.org.uk
        Include /etc/apache2/sites-available/www-common
        RewriteRule ^/$ /blog/app       [PT]

        RewriteLog      /var/log/apache2/rewrite.log
        RewriteLogLevel 0

</VirtualHost>

<VirtualHost 192.168.0.32:80 >
#money.home

        ServerName money.home
        Include /etc/apache2/sites-available/www-common
        RewriteRule     ^/$ /akcmoney/app       [PT]
</VirtualHost>

<VirtualHost 192.168.0.30:80 >
#webmail.home
        ServerName      webmail.home
        DirectoryIndex /cgi-bin/sqwebmail
        Include /etc/apache2/sites-available/www-common
</VirtualHost>

<VirtualHost 192.168.0.30:443 82.43.77.1:443>

        ServerName      www.chandlerfamily.org.uk

        SSLEngine       on
#       SSLProtocol     all
#       SSLCipherSuite  all

#       SSLCACertificateFile    /etc/apache2/ssl/ca.crt
        SSLCertificateFile      /etc/apache2/ssl/server.crt
        SSLCertificateKeyFile   /etc/apache2/ssl/server.key


        Include /etc/apache2/sites-available/www-common
        RewriteRule ^/$ /blog/app       [PT]
</VirtualHost>

        SSLSessionCache dbm:/var/cache/apache2/SSLSessionCache
        SSLSessionCacheTimeout 600

------------------------------------------------------------------

As you can see, www-common is included as it contains all the key 
directives for the site. Here is key part of it
-----------------------------------------------------------------

        DocumentRoot /var/www/chandlerfamily

# define which URLs get passed to tomcat
        JkMount         /blog/* tomcat
        JkMount         /akcmoney/* tomcat
        JkMount         /moneydemo/* tomcat
        JkMount         /usermgr/* tomcat
        JkMount         /famtree/* tomcat

        RewriteEngine   on
#   Force clients from the Internet to use HTTPS
        RewriteCond     %{REMOTE_ADDR} !^192\.168\.0\.2[1-6]$
        RewriteCond     %{HTTPS} !=on
        RewriteRule     ^/akcmoney/.* - [F]

        RewriteCond     %{REMOTE_ADDR} !^192\.168\.0\.2[0-6]$
        RewriteRule     ^/manager/.* - [F]

        RewriteCond     %{REMOTE_ADDR} !^192\.168\.0\.2[0-6]$
        RewriteCond     %{HTTPS} !=on
        RewriteRule     ^/files/secure/.* - [F]

# Break this file up by security Areas
#[SECURITY] Open

        <Directory /var/www/chandlerfamily>
                Order           allow,deny
                Allow           from all
                Options FollowSymLinks MultiViews
        </Directory>

# Protect underlying git repository from access
        <Directory /var/www/chandlerfamily/.git>
                Order   deny,allow
                Deny    from all
        </Directory>

       CustomLog /var/log/apache2/www.log simple



-- 
Alan Chandler
http://www.chandlerfamily.org.uk


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org