PDA

View Full Version : OS X Apache ProxyPass?




Apocrathia
Mar 30, 2010, 07:23 PM
Okay, so I know exactly how to do this in a Linux environment, but I'm still trying to learn OS X Server, so I want to figure out the OS X way to do this.

I have an application running it's own webserver on a different port (We'll use 9090 for this example). I want for mydomain.com/application to forward that application's webserver through 80, over that alias.

Now, I know how to manually edit the apache configuration in Ubuntu and do this with the ProxyPass module. You just have to write in a ProxyPass entry with a forward and reverse proxy. How can I do this on OS X Server (I'm running 10.6.3), through the Server Admin.app?

In Ubuntu, I know just to add this to the /etc/apache2/mods-available/proxy.conf, then make a symlink to mods-enabled.
<Location /application>
ProxyPass http://server:port
ProxyPassReverse http://server:port
</Location>



Apocrathia
Apr 1, 2010, 02:06 AM
Well after about an hour of hacking away at the the /etc/apache2/sites/defaultsite configuration file, I got things working.
So so recap, I'm trying to hide a secondary webserver behind apache. This can actually be applied in many ways.

So within the /etc/apache2/sites/000whatever configuration file, you have all of the proxypass crap towards the bottom. Just add this:
ProxyPass /application/ http://localhost:port/application/
ProxyPassReverse /application/ http://localhost:port/application/
That takes care of most of the abstraction of that service. You can chose to use localhost, your loopback, or even the hostname.local in place of localhost.

The one other problem that I ran into is when you don't have the final / on the uri. So just setup a redirect match in your server admin.app for the site that states /application redirects to /application/

So there you have it, abstracting another server behind apache. Now fill in the blanks.