You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mike Savage <Mi...@datastream.net> on 2002/12/24 06:55:12 UTC
[users@httpd] Apache2 and rewrite issue
I am having some problems with rewrite rules that work fine under
Apache 1.3.27, but do not under Apache 2.0.43. OS is Windows 2000
Server and Apache2 was compiled by myself from source.
I am trying to use rewrite to serve all static content located under a
Tomcat 4.1.12 installation. Again, what I am about to describe works
flawlessly under Apache 1.3.27 serving up static content from the
Tomcat location.
Let's say we have a directory setup like this:
c:\app\tomcat\webapps\web.war\images\(static content
here...html,gifs,js,xsl,swf,whatever)
c:\app\apache2\
So my static content is not located under the htdocs location and I do
not have an alias directive for mapping where the static content would
be served by tomcat.
Under Apache 1.3.27, I either map the /web alias into Apache by way of
mod_jk or turning on the Tomcat http server and ProxyPass and
ProxyPassReverse over localhost:8080 for /web. In addition, the
mod_rewrite LoadModule directive is placed after the mod_jk or
mod_proxy LoadModule directives in the httpd.conf...in order that it
is loaded before mod_jk or mod_proxy. This to insure that mod_rewrite
intercepts the request first and processes it...if a static rewrite
condition is not met it passes through to mod_jk or mod_proxy and
Tomcat handles the rest. Thus mod_rewrite provides URL requests at
/web/images/*.gif for example.
I have many rewrite rules for the different types of static files, but
let's look at the one in particular, say gifs because I just mentioned
it:
RewriteEngine On
RewriteLog "c:/app/apache/logs/rewrite.log"
RewriteLogLevel 3
RewriteRule ^/web/images/(.*)\.gif$
/app/tomcat/webapps/web.war/images/$1.gif [L]
The above rewrite rule functions fine under Apache 1.3.27 and the
local path for the static gif is found and Apache serves the file.
Under Apache 2.0.43, I see the following in the rewrite.log:
10.1.213.73 - - [19/Dec/2002:04:41:43 --0500]
[guardia/sid#23bd48][rid#78f680/initial] (2) init rewrite engine with
requested uri /web/images/backdrop.gif
10.1.213.73 - - [19/Dec/2002:04:41:43 --0500]
[guardia/sid#23bd48][rid#78f680/initial] (3) applying pattern
'^/web/images/(.*)\.gif$' to uri '/web/images/backdrop.gif'
10.1.213.73 - - [19/Dec/2002:04:41:43 --0500]
[guardia/sid#23bd48][rid#78f680/initial] (2) rewrite
/web/images/backdrop.gif ->
/app/tomcat/webapps/web.war/images/backdrop.gif
10.1.213.73 - - [19/Dec/2002:04:41:43 --0500]
[guardia/sid#23bd48][rid#78f680/initial] (2) local path result:
/app/tomcat/webapps/web.war/images/backdrop.gif
But in my browser, I get an HTTP 400 - Bad Request message.
The above example occurs when using mod_proxy and mod_rewrite...the
same occurs when using mod_jk, however, I have to place the
mod_rewrite LoadModule directive _before_ mod_proxy or mod_jk
LoadModules directives in httpd.conf in order for mod_rewrite to
intercept the request. If the mod_rewrite LoadModule directive is
placed after the mod_proxy LoadModule directive (as is the norm under
Apache 1.3.27) mod_proxy passes the request on to Tomcat and I see
nothing in the rewrite.log.
Which leads me to another question:
Is the order of module loading in httpd.conf reversed under Apache2?
Do modules get loaded in the order they naturally occur in httpd.conf
under Apache2?
I would like to be able to use Apache2 rather than Apache1 if
possible. I have read that proxy performance under Apache2 has vastly
improved from that under Apache1. Some benchmarking I have performed
under Apache1 has shown that using
mod_rewrite(static)-mod_proxy(dynamic) with Tomcat outperforms using
mod_rewrite(static)-mod_jk(dynamic) with Tomcat (I have yet to
benchmark either Apache1 or Apache2 with the newer mod_jk2 or
mod_webapp connectors). So naturally, Apache2 with proxying to Tomcat
should perform better than Apache1 proxying to Tomcat...hence my
desire to use Apache2.
I have looked at this for the past several days, including the various
rewrite tutorials listed in the FAQ, and I'm stumped. Any
assistance or pointers anyone can provide would be greatly
appreciated.
Thanks,
Mike
---------------------------------------------------------------------
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