BaseHTTPServer and Apache

R

Ron Garret

I have a fairly large web app written in Python as a CGI fairly
elaborate CGI. All of the requests go through a single CGI script which
does authentication and session management and then dispatches to one of
a number of handlers that generate the various pages.

There is one page that is a performance bottleneck (because it is
accessed automatically once a second by an XMLHTTPRequest, but that's
another story). I have fixed this by re-implementing that page using a
BaseHTTPServer. So I can fix my problem by redirecting the
XMLHTTPRequest to a URL that is served by this BaseHTTPServer.

The problem is that this server can't run on port 80 because Apache has
to be there to serve everything else, and having a Python process
serving a publicly accessible TCP port makes me a little queasy. Does
anyone know of a straightforward way to get Apache to "forward" requests
to a given path to another HTTP server running on a different port?

Also, is anyone out there using BaseHTTPServer in an industrial setting?
What has been your experience with it? And how do you make it fit in to
your overall architecture?

Thanks!
rg
 
R

Ron Garret

Ron Garret said:
Does
anyone know of a straightforward way to get Apache to "forward" requests
to a given path to another HTTP server running on a different port?

Never mind, I think I figured it out. Apparently what I need is the
ProxyPassReverse directive.

I'd still be interested in hearing about people's experience using
BaseHTTPServer for real applications.

Thanks,
rg
 
?

=?iso-8859-1?q?Luis_M._Gonz=E1lez?=

Never mind, I think I figured it out. Apparently what I need is the
ProxyPassReverse directive.

I'd still be interested in hearing about people's experience using
BaseHTTPServer for real applications.

Thanks,
rg


Some python web frameworks use the aproach you described by means of
mod_rewrite.
For example, Karrigell and Cherrypy (although they offer also other
ways of deployment).
This page in Karrigell's docs show how: http://karrigell.sourceforge.net/en/apache.htm
 
R

Ron Garret

"Luis M. González said:
Some python web frameworks use the aproach you described by means of
mod_rewrite.
For example, Karrigell and Cherrypy (although they offer also other
ways of deployment).
This page in Karrigell's docs show how:
http://karrigell.sourceforge.net/en/apache.htm

Thanks for that pointer. Using the 502 handler to start the server is a
nifty trick.

So I've got all that working now. Next question: how do I set things up
so that I can communicate to my server through a unix domain socket
instead of a TCP socket? (The reason I want to do this is that I'm
running multiple copies of this server so that multiple engineers can do
development each in their own sandbox, and assigning each of them their
own port number is a configuration nightmare.)

I got as far as rewriting the server code to use a unix socket, but then
I got stuck.

rg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top