There may be conflicts between mod_rewrite and mod_proxy wrt. the order in 
which the filename to uri translation is done. Either one or the other may do 
the translation first. In Apache 2.2 the order is well-defined. In 2.0 the 
order may depend on the order in which the modules are loaded.

So whenever you proxy, the safest is to use one or the other but not both.

Try this instead. For debugging purposes, set RewriteLogLevel 9 and watch the 
error log.

RewriteEngine On
RewriteRule ^/$ /index.html

RewriteCond %{REQUEST_URI} ^/otherapp/
RewriteRule . http://127.0.0.1:3002%{REQUEST_URI} [L,P]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteRule . http://127.0.0.1:3001%{REQUEST_URI} [L,P]

ProxyPassReverse / http://127.0.0.1:3002
 
<Location /other_app>
Order allow,deny
Allow from All
</Location>


Regarding the QSA it is not needed unless you actually add a query string at 
the end of the second argument of RewriteRule.

-ascs

________________________________

De : Bryan Richardson [mailto:[EMAIL PROTECTED] 
Envoyé : mardi 1 janvier 2008 03:24
À : users@httpd.apache.org
Objet : [EMAIL PROTECTED] Needing help with mod_proxy


Hello all,

I'm currently using mod_proxy to forward non-static pages to my WEBrick server 
for my Rails application.  I'm wanting to setup a second Rails application on 
my website, running on a different port number, and I want to access it via a 
"directory". 

www.mysite.com --> main app
www.mysite.com/other_app --> other app

I tried doing this via a <Location> directive in my site's conf file, but that 
didn't seem to work.  Can someone give me some hints as to how to do this? 

Here's what I currently have for my main app:

<VirtualHost *:80>
ServerName ...
DocumentRoot ...

<Directory same/as/doc/root/>
Options ....
AllowOverride ...
Order allow,deny 
Allow from All
Deny from None
</Directory>

ProxyRequests Off

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

RewriteEngine On
RewriteRule ^/$ /index.html [QSA] 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:3001%{REQUEST_URI} [L,P,QSA]
</VirtualHost>

Having this works perfectly for my main Rails application, letting Apache serve 
static pages and letting WEBrick serve the scripts.  So what do I need to do to 
add another Rails app and proxy requests to the new app when someone goes to 
say www.mysite.com/other_app?  I've tried the following:

<Location /other_app>
Order allow,deny
Allow from All

ProxyPass http://127.0.0.1:3002
ProxyPassReverse http://127.0.0.1:3002
</Location>

This, however, did not work.  Thanks in advance!!! -- BTR


---------------------------------------------------------------------
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: [EMAIL PROTECTED]
   "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to