I'm using the following configuration to proxy requests and rewrite urls from Apache to Tomcat using mod_rewrite, mod_proxy.
# In apache virtual hosts
ProxyRequests Off
ProxyPreserveHost On
...
# In .htaccess file
#forward non-resource URL to jsp
RewriteRule ^([^\.]+)/?$ http://localhost:8080/mycontext/$1.jsp [P]
My question: is it possible to instruct Tomcat to keep the original URI so that I can read it using a request.getRequestURI()? Is this configuration possible or do I have to resort to mod_jk or some other proxy Connector?
The host name is retained currently... not the request path. I'm also using Apache 2.2 and Tomcat 6.
A not too cumbersome solution:
RewriteRule ^([^\.]+)/?$ http://localhost:8080/mycontext/$1.jsp&_requri_=%{REQUEST_URI}
Then read the request uri from the _requri_ query parameter.
If there's a better way, please let me know.