You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jerry Malcolm <te...@malcolms.com> on 2020/07/20 18:24:00 UTC

Rewrite Valve Problem

My next step in moving httd/mod_jk out of the chain is to move my 
rewrite rules to Tomcat.  The instructions are pretty straightforward.  
I added the rewrite value to the host in server.xml, and I created 
rewrite.index in the host's folder in Catalina directory.

The rewrite itself seems to work.  But then Tomcat says it can't find 
the rewritten url.  Yet when I type the exact same url in directly it 
finds it.  I turned on all of the logging to see what might be different 
between the two.  The only difference other than the 404 rc is the 
session id is blank:

URL entered directly:

127.0.0.1 169.254.189.98 164819 164819 127.0.0.1 HTTP/1.1 - GET 80  200 
B36DBE839DCFEA86727170B17F3BDEAB [20/Jul/2020:12:57:18 -0500] - 
/aaa/jsp/guest/altHome.jsp local.*****.com 1226 1.226 http-nio-80-exec-1 
"GET /aaa/jsp/guest/altHome.jsp HTTP/1.1"

Rewritten url:

127.0.0.1 169.254.189.98 1078 1078 127.0.0.1     HTTP/1.1 - GET 80  404 
-                                [20/Jul/2020:12:57:51 -0500] - 
/aaa/jsp/guest/altHome.jsp local.*****.com 48   0.048 http-nio-80-exec-3 
"GET /aaa/jsp/guest/altHome.jsp HTTP/1.1"

Note the final URL is identical in both cases.

Am I missing something in the rewrite configuration or the 
rewrite.config file entries?

Please give me some ideas.  We can't move forward until we get this going.

Thx (BTW -- TC 9.0.16)

Jerry


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


Re: Rewrite Valve Problem

Posted by Kenneth Noel <ke...@bc.edu>.
Thanks to the both of you for the help

On Wed, Jul 22, 2020 at 4:46 AM Martin Grigorov <mg...@apache.org>
wrote:

> Hi Jerry,
>
> On Tue, Jul 21, 2020 at 2:39 AM Jerry Malcolm <te...@malcolms.com>
> wrote:
>
> >
> > On 7/20/2020 5:00 PM, Mark Thomas wrote:
> > > On 20/07/2020 22:43, Jerry Malcolm wrote:
> > >
> > > <snip/>
> > >
> > >>> Do you have a ROOT web application deployed? If not, this could be
> > >>> https://bz.apache.org/bugzilla/show_bug.cgi?id=64593
> > >> Mark, I do not have a root context.  So that very likely is the
> > >> problem.  Not 100% sure why the thought is that there should always
> be a
> > >> root context.  But I'm sure there are good reasons.  Easy enough to
> > >> create one.  I'll let you know.
> > > Generally, I'd expect to see a ROOT context so there is something there
> > > to handle requests that don't map to any other context. It is easier to
> > > deploy custom 404 error pages if you have a ROOT context for example.
> > >
> > > That said, it isn't necessary and we do treat stuff not working without
> > > a ROOT context as a bug.
> > >
> > > All you need to fix BZ 64593 is a directory called ROOT in webapps.
> >
> > Wow.  4 little letters.... I've been using TC for over 15 years without
> > a ROOT.  Probably because I never routed anything through mod_jk that
> > didn't match a known context.   I have no problem if you want to treat
> > not having a ROOT context as a bug,   But please give an error message
> >
>
> As explained earlier by Mark this was a bug and it is fixed for the next
> release.
> Using a dummy ROOT folder is a workaround until the next release.
>
>
> > in startup and/or provide an error message if/when rewrite valve fails
> > because there is no ROOT context defined.  Thank you for explaining
> > what's happening.  There is not a chance I would have correlated my
> > symptoms in 100 years to not having a ROOT context.  I really do
> > appreciate the help.   All working now....
> >
> > Jerry
> >
> > > Mark
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>


-- 
Kenneth Noel
Boston College
DBA
(617) 552-8511

Re: Rewrite Valve Problem

Posted by Martin Grigorov <mg...@apache.org>.
Hi Jerry,

On Tue, Jul 21, 2020 at 2:39 AM Jerry Malcolm <te...@malcolms.com>
wrote:

>
> On 7/20/2020 5:00 PM, Mark Thomas wrote:
> > On 20/07/2020 22:43, Jerry Malcolm wrote:
> >
> > <snip/>
> >
> >>> Do you have a ROOT web application deployed? If not, this could be
> >>> https://bz.apache.org/bugzilla/show_bug.cgi?id=64593
> >> Mark, I do not have a root context.  So that very likely is the
> >> problem.  Not 100% sure why the thought is that there should always be a
> >> root context.  But I'm sure there are good reasons.  Easy enough to
> >> create one.  I'll let you know.
> > Generally, I'd expect to see a ROOT context so there is something there
> > to handle requests that don't map to any other context. It is easier to
> > deploy custom 404 error pages if you have a ROOT context for example.
> >
> > That said, it isn't necessary and we do treat stuff not working without
> > a ROOT context as a bug.
> >
> > All you need to fix BZ 64593 is a directory called ROOT in webapps.
>
> Wow.  4 little letters.... I've been using TC for over 15 years without
> a ROOT.  Probably because I never routed anything through mod_jk that
> didn't match a known context.   I have no problem if you want to treat
> not having a ROOT context as a bug,   But please give an error message
>

As explained earlier by Mark this was a bug and it is fixed for the next
release.
Using a dummy ROOT folder is a workaround until the next release.


> in startup and/or provide an error message if/when rewrite valve fails
> because there is no ROOT context defined.  Thank you for explaining
> what's happening.  There is not a chance I would have correlated my
> symptoms in 100 years to not having a ROOT context.  I really do
> appreciate the help.   All working now....
>
> Jerry
>
> > Mark
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Rewrite Valve Problem

Posted by Jerry Malcolm <te...@malcolms.com>.
On 7/20/2020 5:00 PM, Mark Thomas wrote:
> On 20/07/2020 22:43, Jerry Malcolm wrote:
>
> <snip/>
>
>>> Do you have a ROOT web application deployed? If not, this could be
>>> https://bz.apache.org/bugzilla/show_bug.cgi?id=64593
>> Mark, I do not have a root context.  So that very likely is the
>> problem.  Not 100% sure why the thought is that there should always be a
>> root context.  But I'm sure there are good reasons.  Easy enough to
>> create one.  I'll let you know.
> Generally, I'd expect to see a ROOT context so there is something there
> to handle requests that don't map to any other context. It is easier to
> deploy custom 404 error pages if you have a ROOT context for example.
>
> That said, it isn't necessary and we do treat stuff not working without
> a ROOT context as a bug.
>
> All you need to fix BZ 64593 is a directory called ROOT in webapps.

Wow.  4 little letters.... I've been using TC for over 15 years without 
a ROOT.  Probably because I never routed anything through mod_jk that 
didn't match a known context.   I have no problem if you want to treat 
not having a ROOT context as a bug,   But please give an error message 
in startup and/or provide an error message if/when rewrite valve fails 
because there is no ROOT context defined.  Thank you for explaining 
what's happening.  There is not a chance I would have correlated my 
symptoms in 100 years to not having a ROOT context.  I really do 
appreciate the help.   All working now....

Jerry

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

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


Re: Rewrite Valve Problem

Posted by Mark Thomas <ma...@apache.org>.
On 20/07/2020 22:43, Jerry Malcolm wrote:

<snip/>

>> Do you have a ROOT web application deployed? If not, this could be
>> https://bz.apache.org/bugzilla/show_bug.cgi?id=64593
> Mark, I do not have a root context.  So that very likely is the
> problem.  Not 100% sure why the thought is that there should always be a
> root context.  But I'm sure there are good reasons.  Easy enough to
> create one.  I'll let you know.

Generally, I'd expect to see a ROOT context so there is something there
to handle requests that don't map to any other context. It is easier to
deploy custom 404 error pages if you have a ROOT context for example.

That said, it isn't necessary and we do treat stuff not working without
a ROOT context as a bug.

All you need to fix BZ 64593 is a directory called ROOT in webapps.

Mark

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


Re: Rewrite Valve Problem

Posted by Jerry Malcolm <te...@malcolms.com>.
On 7/20/2020 3:42 PM, Mark Thomas wrote:
> On 20/07/2020 19:24, Jerry Malcolm wrote:
>> My next step in moving httd/mod_jk out of the chain is to move my
>> rewrite rules to Tomcat.  The instructions are pretty straightforward.
>> I added the rewrite value to the host in server.xml, and I created
>> rewrite.index in the host's folder in Catalina directory.
>>
>> The rewrite itself seems to work.  But then Tomcat says it can't find
>> the rewritten url.  Yet when I type the exact same url in directly it
>> finds it.  I turned on all of the logging to see what might be different
>> between the two.  The only difference other than the 404 rc is the
>> session id is blank:
>>
>> URL entered directly:
>>
>> 127.0.0.1 169.254.189.98 164819 164819 127.0.0.1 HTTP/1.1 - GET 80  200
>> B36DBE839DCFEA86727170B17F3BDEAB [20/Jul/2020:12:57:18 -0500] -
>> /aaa/jsp/guest/altHome.jsp local.*****.com 1226 1.226 http-nio-80-exec-1
>> "GET /aaa/jsp/guest/altHome.jsp HTTP/1.1"
>>
>> Rewritten url:
>>
>> 127.0.0.1 169.254.189.98 1078 1078 127.0.0.1     HTTP/1.1 - GET 80  404
>> -                                [20/Jul/2020:12:57:51 -0500] -
>> /aaa/jsp/guest/altHome.jsp local.*****.com 48   0.048 http-nio-80-exec-3
>> "GET /aaa/jsp/guest/altHome.jsp HTTP/1.1"
>>
>> Note the final URL is identical in both cases.
>>
>> Am I missing something in the rewrite configuration or the
>> rewrite.config file entries?
>>
>> Please give me some ideas.  We can't move forward until we get this going.
>>
>> Thx (BTW -- TC 9.0.16)
> Do you have a ROOT web application deployed? If not, this could be
> https://bz.apache.org/bugzilla/show_bug.cgi?id=64593
Mark, I do not have a root context.  So that very likely is the 
problem.  Not 100% sure why the thought is that there should always be a 
root context.  But I'm sure there are good reasons.  Easy enough to 
create one.  I'll let you know.
>
> If that isn't it, if you can provide the simplest configuration that
> recreates the issue on a clean Tomcat 9.0.latest install, someone should
> be able to take a look.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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


Re: Rewrite Valve Problem

Posted by Mark Thomas <ma...@apache.org>.
On 20/07/2020 19:24, Jerry Malcolm wrote:
> My next step in moving httd/mod_jk out of the chain is to move my
> rewrite rules to Tomcat.  The instructions are pretty straightforward. 
> I added the rewrite value to the host in server.xml, and I created
> rewrite.index in the host's folder in Catalina directory.
> 
> The rewrite itself seems to work.  But then Tomcat says it can't find
> the rewritten url.  Yet when I type the exact same url in directly it
> finds it.  I turned on all of the logging to see what might be different
> between the two.  The only difference other than the 404 rc is the
> session id is blank:
> 
> URL entered directly:
> 
> 127.0.0.1 169.254.189.98 164819 164819 127.0.0.1 HTTP/1.1 - GET 80  200
> B36DBE839DCFEA86727170B17F3BDEAB [20/Jul/2020:12:57:18 -0500] -
> /aaa/jsp/guest/altHome.jsp local.*****.com 1226 1.226 http-nio-80-exec-1
> "GET /aaa/jsp/guest/altHome.jsp HTTP/1.1"
> 
> Rewritten url:
> 
> 127.0.0.1 169.254.189.98 1078 1078 127.0.0.1     HTTP/1.1 - GET 80  404
> -                                [20/Jul/2020:12:57:51 -0500] -
> /aaa/jsp/guest/altHome.jsp local.*****.com 48   0.048 http-nio-80-exec-3
> "GET /aaa/jsp/guest/altHome.jsp HTTP/1.1"
> 
> Note the final URL is identical in both cases.
> 
> Am I missing something in the rewrite configuration or the
> rewrite.config file entries?
> 
> Please give me some ideas.  We can't move forward until we get this going.
> 
> Thx (BTW -- TC 9.0.16)

Do you have a ROOT web application deployed? If not, this could be
https://bz.apache.org/bugzilla/show_bug.cgi?id=64593

If that isn't it, if you can provide the simplest configuration that
recreates the issue on a clean Tomcat 9.0.latest install, someone should
be able to take a look.

Mark

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