2

I have been using apache as a reverse proxy to a puma application server (RoR). The assets are all in a subdirectory called assets, and I added a line to the apache configuration like this:

<Location /assets>
  ProxyPass !
</Location>

This worked fine, the static stuff was served by apache, everything else was proxied to puma. However I want to implement load balancing, so I added the following lines to the config:

<Proxy balancer://mycluster>
  BalancerMember http://localhost:9292
  BalancerMember http://192.168.1.2:9292
</Proxy>

and set the proxy pass and proxy pass reverse directives to this

ProxyPass / balancer://mycluster lbmethod=byrequests
ProxyPassReverse / balancer://mycluster

Now the assets directory does not work, I get a 500 error when the browser tries to get any of the files in the directory. In the server error log, the following line pops up:

 [Wed Aug 28 15:31:52 2013] [warn] proxy: No protocol handler was valid for 
 the URL /assets/application-c713b532d29cd16b1e8d99df39489e72.css. If you 
 are using a DSO version of mod_proxy, make sure the proxy submodules are 
 included in the configuration using LoadModule.

Can anyone suggest why my configuration no longer works? Full config is here

-- EDIT --

Actually the only path that works is the root path, none of the other requests that would previously have been proxied to the puma server work either.

3

I'd use the ProxyPassMatch directive for better control:

ProxyPassMatch ^/assets/.*$ !
ProxyPassMatch ^/(.*)$ balancer://mycluster/$1 lbmethod=byrequests
ProxyPassReverse / balancer://mycluster

<Proxy balancer://mycluster>
  BalancerMember http://localhost:9292
  BalancerMember http://192.168.1.2:9292
</Proxy>

Because the directives are evaluated in the order in which they appear, you assets directory should not be proxied, while the rest of the URLs would use the balancer.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.