469,643 Members | 1,903 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

BaseHTTPServer and Apache

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
Apr 13 '07 #1
3 2230
In article <rN*****************************@news.gha.charterm i.net>,
Ron Garret <rN*******@flownet.comwrote:
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
Apr 13 '07 #2
On Apr 13, 8:44 pm, Ron Garret <rNOSPA...@flownet.comwrote:
In article <rNOSPAMon-8BDDE1.16253913042...@news.gha.chartermi.net>,
Ron Garret <rNOSPA...@flownet.comwrote:
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

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

Apr 14 '07 #3
In article <11*********************@y5g2000hsa.googlegroups.c om>,
"Luis M. González" <lu*****@gmail.comwrote:
On Apr 13, 8:44 pm, Ron Garret <rNOSPA...@flownet.comwrote:
In article <rNOSPAMon-8BDDE1.16253913042...@news.gha.chartermi.net>,
Ron Garret <rNOSPA...@flownet.comwrote:
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


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
Apr 14 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Joshua W. Biagio | last post: by
1 post views Thread by Yin | last post: by
4 posts views Thread by amfr | last post: by
reply views Thread by Jeff Gercken | last post: by
reply views Thread by Ron Garret | last post: by
13 posts views Thread by Ron Garret | last post: by
reply views Thread by samwyse | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.