Search code examples
phpapachemod-proxymiddleman

How to proxy apache to middleman server


I'm developing a frontend application with Middleman on a pre-existing php backend. In the production server my app will be a subfolder of the main app, but during the development phase I wish to keep the two app completely separated.

I have installed the php app in my local apache. Now I want apache to proxy the middleman app path to the middleman server.

I tried with:

<Location /phpapp/static>
  ProxyPass http://127.0.0.1:4567/
  ProxyPassReverse http://127.0.0.1:4567/
</Location>

and bind middleman server to 127.0.0.1

but I get "Not Found: /"

I think this response comes from the middleman because, if I turn off the middleman server, apache responds with a "Service unavailable".

So, how can I have middleman server to send its contents through apache?


Solution

  • I manage to solve it by modifying the configuration in this way.

    ProxyRequests Off
    
    <Location /phpapp/static>
      ProxyPass http://127.0.0.1:4567/
      ProxyPassReverse http://127.0.0.1:4567/
      ProxyPreserveHost On
    </Location>
    

    The attempt I made using passenger failed because of dynamic assets that weren't served by Apache.