 HOWTO: Proxying through a Webserver
Last modified 12/22/2003.
This document describes how you can run CourseForum or ProjectForum proxied behind
an existing webserver. It describes why you might want to do this,
what you'll need, and provides an example of the changes needed to
run proxied behind Apache on Mac OS X.
Why run proxied?
Normally, CourseForum and ProjectForum will run so that connections from users'
browsers are handled directly.
When running proxied, your main web server (or possibly a dedicated
proxy server, if you have one) will accept all web connections.
Those that it decides are designated for CourseForum or ProjectForum will then be
forwarded (proxied) to CourseForum or ProjectForum to handle.
This can be very convenient, because normally you'd like all
web servers and applications (including CourseForum and ProjectForum) to run on
port 80, which is the default port for web content. You can't
have two different programs (such as your web server and CourseForum or ProjectForum)
both running on port 80 at the same time, unless you have multiple
IP addresses on your machine.
You can also use proxying to make it appear that CourseForum or ProjectForum is just
a regular part of your existing web server, rather than an entirely
separate web server.
What you need
You will need to be running a web server that supports proxying
connections. Most servers, such as Apache, do this. You must
also be running CourseForum or ProjectForum (on for example, the default port, 3455).
Note: Apache versions 1.3.23 and 1.3.24 have a bug in their
handling of cookies with proxies that will interfere with CourseForum or ProjectForum.
You should upgrade to a newer version if you're running one of those.
You must also be comfortable configuring your web server. This
usually means (on Unix machines) having root access, using the
Unix shell, and editing configuration files.
You also have to decide how you want CourseForum or ProjectForum to be proxied.
You have two basic choices: proxied from a single directory, or
proxied via a separate hostname:
- When proxying from a directory, CourseForum or ProjectForum will be
accessed by a subdirectory of your main server, so you'll
need to choose what that would be. For example, if your main
server is "http://www.myserver.com", you might want to access
CourseForum by "http://www.myserver.com/courseforum/".
- You can use proxying by hostname If you can have multiple
hostnames all pointing to the same IP address of your web server.
For example, if your web server is "http://www.myserver.com", you
might want to setup a hostname "http://courseforum.myserver.com"
pointing to the same IP address. This is known as name-based
virtual hosting.
Example: Apache on MacOS X
In this example, we'll setup CourseForum to run proxied from a
directory in your main web server. This example will be specific
to MacOS X, but will be very similar for other Unix systems running
Apache.
First, make sure you're running CourseForum. We'll assume for this
example that you're running it from the default port (3455), but you
can pick any port you'd like.
Second, make sure you've got "Personal Web Sharing" (Apache) turned on.
You can start it via System Preferences, in the "Sharing" panel. You
can verify this is working by opening http://127.0.0.1 in your web
browser.
You'll now need to make some changes to Apache's configuration file.
Open up the Terminal application. Type the following command to
open Apache's configuration file in TextEdit. You'll need to type
in your Administration password when prompted:
sudo open -e /etc/httpd/httpd.conf
Search through the file to find lines that start with "LoadModule proxy_module"
and "AddModule mod_proxy.c". If they have a hash/pound sign ("#") at the start,
remove it. This will enable proxy support in the web server.
At just before the end of the file, you'll find a section dealing with
Virtual Hosting. Add the following lines to the file, which will tell
Apache that any requests starting with "/courseforum" should be proxied
to the server (CourseForum) running on port 3455. In the example we'll
assume that people are accessing the site via the external IP address
192.168.0.1:
Redirect /courseforum http://192.168.0.1/courseforum/
<VirtualHost *>
ProxyPass /courseforum/ http://127.0.0.1:3455/
</VirtualHost>
If you wanted to instead to a name based proxy, you might instead add lines
similar to the following:
<VirtualHost *>
ServerName courseforum.myserver.com
ProxyPass / http://127.0.0.1:3455/
</VirtualHost>
Depending on your setup, you may also need these lines:
ProxyRequest off
ProxyPass Reverse / http://127.0.0.1:3455
Save the httpd.conf file, and then restart the web server (Stop then Start
Personal Web Sharing in the Sharing System Preferences panel). If you then
open "http://127.0.0.1/courseforum/" in your browser, you should see the main
CourseForum page.
Proxying through IIS on Windows
Microsoft's IIS web server does not contain proxying capabilities built-in,
but requires add-on products to provide this. You can find a number of
commercial proxy servers for IIS, both from Microsoft and from other
companies.
One of our customers has recommended a low cost product called
ISAPI_Rewrite, which among
other things provides proxy support. With it you can have IIS proxy
to a ProjectForum site on a different, internal-only web server with
only a single line configuration change.
|