nexar
nexar

Reputation: 11336

Can Apache Reverse Proxy exclude certain file types?

I have an Apache/Passenger combo serving Rails 3.x and the same combo serving Rails 2.x via a reverse proxy to Passenger Standalone. The reason I'm doing this is because Rails 2.x uses an older version of Ruby than the Ruby used by the Apache/Passenger.

However there is a bit of php in the Rails 2.x app which Passenger Standalone cannot support. (Confirmed by Hongli Lai on the Passenger Discussion Group). Hongli suggests excluding the 'php' bits from the Reverse Proxy.

Can this be done, and if so how?


Edit to show how the Reverse proxy has been set up:

<VirtualHost *:80>
   ServerName gtt
   DocumentRoot /home/purvez/www/gtt/public
   RailsEnv development
   PassengerEnabled off
   ProxyPass / http://127.0.0.1:3000/
   ProxyPassReverse / http://127.0.0.1:3000/
</VirtualHost>

Also how an ordinary site has been set up:

<VirtualHost *:80>
   ServerName testapp
   DocumentRoot /home/purvez/www/testapp/public
   RailsEnv development
</VirtualHost>

Upvotes: 3

Views: 3472

Answers (1)

e.dan
e.dan

Reputation: 7507

You could use ProxyPassMatch to exclude, as follows:

<VirtualHost *:80>
   ServerName gtt
   DocumentRoot /home/purvez/www/gtt/public
   RailsEnv development
   PassengerEnabled off
   ProxyPassMatch .*\.php$ !
   ProxyPass / http://127.0.0.1:3000/
   ProxyPassReverse / http://127.0.0.1:3000/
</VirtualHost>

Note that this will cause all 'php bits' in the virtual host named gtt to be served locally from /home/purvez/www/gtt/public.

Hope this gets you moving in the right direction.

Upvotes: 8

Related Questions