Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Apache Tomcat
| Search | Today's Posts | Mark Forums Read
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 5th, 2005, 12:34 PM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default mod_jk + apache + mod_rewrite

Hi there,

I have managed to get apache and tomcat working together fine except for one thing in the mod_rewrite.

here is my mod_rewrite bi in http.conf
[...]
RewriteEngine on

RewriteRule "^/file(.*)$" "/dir/servlet/file$1" [R,L]
RewriteCond "%{SERVER_PORT}" "^80$"
RewriteRule "^(.*)$" "https://%{SERVER_NAME}$1" [R,L]
[...]

that works fine. Except that the URL is redirected (R flag) which I don't wan't.
If I use
RewriteRule "^/file(.*)$" "/dir/servlet/file$1" [L]
alone it works fine but if I use it with the HTTPS redirect then the URL rewriting is visible to the user

http://server.domain/file.whatever?key=value

becomes

https://server.domain/dir/servlet/fi...ever?key=value

It would like it to be
https://server.domain/file.whatever?key=value

I have tried to change my rewriting rules to
RewriteCond "%{SERVER_PORT}" "^80$"
RewriteRule "^(.*)$" "https://%{SERVER_NAME}$1" [R,L]
RewriteRule "^/file(.*)$" "/dir/servlet/file$1" [PT,L]

but no matter wich way I turn it mod_jk doesn't take it. (Apache return a 403 error on the file name). I have to use the R flag to make it work.

As I said earlier
RewriteRule "^/file(.*)$" "/dir/servlet/file$1" [L]
works fine and the URLs
http://server.domain/file.whatever?key=value
are handled by tomcat.

I don't what I am missing out and doing wrong....

Hope this makes sense.
Any suggestions or pointer is mostly appreciated.

Regards
Fanch


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mod_rewrite heerajee Pro PHP 1 March 8th, 2006 06:35 AM
Apache mod_rewrite() anshul Linux 2 October 14th, 2005 09:09 AM
apache virtual server, mod_jk, tomcat 5 curiousmind Apache Tomcat 1 May 17th, 2005 09:44 AM
RedHat 9, Apache, Tomcat, mod_jk pzh19z Apache Tomcat 0 January 2nd, 2004 12:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.