You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Kraal <ro...@bibit.com> on 2000/07/07 11:19:34 UTC

URLRewriting and Apache+tomcat

Hello,
I am using Tomcat 3.2 b1 (but had this problem with previous versions of
tomcat too!) in combination with Apache/1.3.9 (RedHat linux).

I made two simple jsp's:


Test.jsp:

HEADER NAMES:<br>
<% java.util.Enumeration e = request.getHeaderNames();
while (e.hasMoreElements()) {
        String name = (String)e.nextElement();
        %> <%= name %>: <%= request.getHeader(name) %><br> <%
}
%>
<html>
        <body>
<br>
                Session : <%= session.getId() %>
                <br>
                encodeURL :             <%=
response.encodeURL("Test2.jsp") %>
                <br>
                encodeRedirectURL :     <%=
response.encodeRedirectURL("Test2.jsp") %>
                <form method="post" action="<%=
response.encodeRedirectURL("Test2.jsp") %>;jsessionid=<%=
session.getId() %>">
                        <input type="hidden" name="test" value="robert">

                        <input type="submit" name="probeer">
                </form>
        </body>
<html>


//note that the post in the form has the ;jsessionid=... extra, this way
both encodeURL encodeRedirectURL will be printed(actually nothing
happens, but thats my problem) and we "fake URL rewriting" by adding
this extra string

Test2.jsp:

Here are the results<br>
SessionID : <%= session.getId() %>
<br>
from URL ? : <%= request.isRequestedSessionIdFromURL() %>
<br>
Query vars : <%= request.getQueryString() %>
<br>

//just prints some information.


Ok I have apache+tomcat working together except for the URL rewriting
part, when I call Test.jsp on my apache webserver (port 80) I get a 404
file not found, when I call it on port 8080 (default port tomcat) it
works!  (I do not accept cookies, otherwise URL rewriting would be
pointless ;-)
When I look in the access_log file and error logs from apache I do not
see anything unusual (except the 404) does anybody have an idea why my
URL rewriting tests are not working?
I think it must be some apache/tomcat setting or perhaps mod_jserv, but
I am using a quit new mod_jserv.
can anybody help?
thanks

Re: URLRewriting and Apache+tomcat

Posted by Raphael Pierquin <ra...@mail.dotcom.fr>.
Hi,

I had the same issue/config, it seems that apache doesn't  match URLs
ending in .jsp;jsession=... as jsp URLs. I guess that's why it doesn't
forward the query to tomcat and replies a 404.

Theese lines in my apache config file fixed it:

       <LocationMatch \.jsp;jsessionid= >
                SetHandler jserv-servlet
        </LocationMatch>

This might not be the cleanest way to solve the problem, but at least it
works.
Regards,
--
Raphael Pierquin

> Ok I have apache+tomcat working together except for the URL rewriting
> part, when I call Test.jsp on my apache webserver (port 80) I get a
> 404 file not found, when I call it on port 8080 (default port tomcat)
> it works!  (I do not accept cookies, otherwise URL rewriting would be
> pointless ;-)

> When I look in the access_log file and error logs from apache I do not
> see anything unusual (except the 404) does anybody have an idea why my
> URL rewriting tests are not working?