Why do some rewrite rules fail while AJP is serving all of my requests to Tomcat?
I have a Apache server using mod_proxy_ajp to have Jboss/Tomcat5.5 handling all the requests. Here is how I configured Apache 2.2.17, and for the most part, it works:
# Proxy pass all work to Tomcat, mod_jk 1.2.31
<Location />
# ProxyPass / http://localhost:8080/
ProxyPass ajp://localhost:8009/
ProxyPassReverse ajp://localhost:8009/
</Location>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
# and , to handle the redirect of the root dir
Redirect permanent / https://%{HTTP_HOST}%/myapp
Unfortunately, while ProxyPass is enabled, I am not able to get any mod_rewrite rules to work except for the ones above. How do I handle this situation?
I am trying to create a rewrite rule similar to this RedirectMatch rule (which only works if I turn off ProxyPass):
RedirectMatch ^/(?i)myagency "/myapp?agency=MyAgency%20LA"
Also, another wierd thing I found, which may provide insight to my issue, is posted here .
You could convert your ProxyPass and ProxyPassReverse directives to RewriteRule directives instead, using [P] to proxy the request, like so:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule (.*) ajp://localhost:8009/$1 [P]
Check more discussion of this question.
Related posts:
- How does Apache mod_proxy_ajp work when Jboss runs as a cluster with AJP on 2 different ports?
- Question about the syntax of the ProxyPass directive
- Apache mod_jk serves JSP through HTTP but fails to server JSP via HTTPS protocol?
- am i adding mod_proxy on CentOS with tomcat/apache correctly?
- Apache rewrite multiple conditions
Leave a comment
Recent Posts
- Is there a way for administrators to disable users from installing Firefox extensions?
- Is there research material on NTP accuracy available?
- How to create a limited “domain admin” that does not have access to domain controllers?
- Can Windows RDC admin users be immune from being kicked?
- Domain Administrators account policy (After PCI audit)
Tags
active-directory
amazon-ec2
apache
apache2
backup
bash
centos
cisco
command-line
debian
dns
email
exchange
firewall
iis
iis7
iptables
linux
macosx
monitoring
mysql
networking
nginx
performance
permissions
php
postfix
raid
security
sql-server
sql-server-2005
sql-server-2008
ssh
ssl
ubuntu
unix
virtualization
vpn
webserver
windows
windows-7
windows-server-2003
windows-server-2008
windows-server-2008-r2
windows-xp





