Re: [users@httpd] Location of rewrite rules when using mod_proxy in 2.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I will try to use the ProxyPass directive. I think I tried that first and ran into a limitation that I want to do three things:
1) only redirect if the requests starts with /backoffice-production
2) if #1 then redirect to jboss on port 9009 if the url ends with *.its
3) otherwise redirect to tomcat on port 8009

Does ProxyPass accept wildcards?  I'll give it a try here shortly.

If there is a better way to accomplish what I am trying to do in those three requirements without using rewriting, I would appreciate a pointer. I had searched the lists for similar criteria and thought Rewriting was the way to go.

The following are the all the entries I added to get this to work without any VirtualHost blocks. Now I'm trying to get it to work with VirtualHosts. Here are all the changes I made to the stock httpd.conf file (beyond standard things like ServerName and DocumentRoot).


<part of httpd.conf>

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

ProxyRequests Off

<Proxy *>
   Order deny,allow
   Allow from all
</Proxy>

RewriteEngine on
RewriteLogLevel 5
RewriteLog "rewrite.log"

######### JBoss
#example URL  some.domain.com/backoffice-production/some/path/edit.its
#example URL  other.domain.com/backoffice-production/other/path/edit.its

RewriteCond %{REQUEST_URI} /backoffice-production/(.*).its(.*)
RewriteRule ^/(.*) ajp://localhost:9009/$1 [P]

#example URL  some.domain.com/backoffice-production/js/functions.js
RewriteCond %{REQUEST_URI} /backoffice-production/js(.*)
RewriteRule ^/(.*) ajp://localhost:9009/$1 [P]


######### TOMCAT
#example URL  some.domain.com/backoffice-production/other/path2/edit.jsf

RewriteCond %{REQUEST_URI} /backoffice-production(.*)
RewriteRule ^/(.*) ajp://localhost:8009/$1 [P]

</part of httpd.conf>

Thanks,
Chris....



David Salisbury wrote:
Well, you may need Rewrite or you may not.. but for the immediate problem
below have you checked into using the ProxyPass directives outside of the VirtualHost blocks?

...something along the lines of

ProxyPass /ajp://localhost:8009/
ProxyPassReverse / ajp://domain.com:8009

-ds

----- Original Message ----- From: "Chris Hane" <chrishane@xxxxxxxxx>
To: <users@xxxxxxxxxxxxxxxx>
Sent: Wednesday, September 27, 2006 9:08 AM
Subject: [users@httpd] Location of rewrite rules when using mod_proxy in 2.2


I am about to upgrade from 2.0 to 2.2.

Our current configuration is pretty simple. We have a couple of virtual hosts and are using mod_jk to talk to 3 applications in Tomcat. The mod_jk rules are not in a VirtualHost but are in the top level of the http.conf file. This setup allows any domain to use the application. An example of the configuration is:

#[jboss]
JkMount /backoffice-demo/faces* worker2
#[tomcat]
JkMount /backoffice-demo* worker1

Since we are moving to 2.2, we decide to move to mod_proxy_ajp. However, the rewrite rules seem to have to be in a VirtualHost block in order to work. If we have them at the top level (not in a VirtualHost) block, they are never executed. Is there a way to have a set of rewrite rules apply to ALL requests regardless of the requested host domain?

An example of the rewrite rule is (just in case it makes a difference):

#[jboss]
RewriteCond %{REQUEST_URI} /backoffice-demo/faces(.*)
RewriteRule ^/(.*) ajp://localhost:9009/$1 [P]

#[tomcat]
RewriteCond %{REQUEST_URI} /backoffice-local(.*)
RewriteRule ^/(.*) ajp://localhost:8009/$1 [P]

These work great if there are not any VirtualHosts or if they are in a VirtualHost. However, we want any domain that this server handles to be able to use these rewrites.

TIA,
Chris....


---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux