473,399 Members | 3,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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 2386
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Molly | last post by:
Peace, Pythonphiles! Python's std lib BaseHTTPServer: I'm stuck with a nasty spoiler -- I get erratic "Network error: disconnected by peer" for _POST_ requests only. =Background= I'm...
0
by: Joshua W. Biagio | last post by:
Hello all, I am having difficulty getting the HTTP/1.1 support (i.e. pipelining and persistent connections) for the BaseHTTPServer library to work. When I change the line for the protocol in...
1
by: Yin | last post by:
Hello. I am using the basehttpserver to implement the HTTP protocol to serve a fairly large lexicon that I have loaded as a dictionary in python. Rather than writing a whole server, I would like...
2
by: Tortelini | last post by:
I am making custom web server using HTTPServer and want to be able to access it simultaneously from different computers. To achieve multithreading, I have been experimenting with ThreadingMixIn...
4
by: amfr | last post by:
>From the BaseHTTPServer module, how do i gget the POST or GET data sent by the client? Is it stired the the file they requested? e.g. objectname.path
0
by: Jeff Gercken | last post by:
I want my http server to return a default form, regardless of the GET request, but I'm a bit of a noob and have no idea how. I'm trying to write a platform-independent captured portal for my...
0
by: Ron Garret | last post by:
I'm write a web server using BaseHTTPServer. It can't be a CGI because it has to do some weird server-push stuff as database updates come in. But I still need to process form inputs as if it were...
13
by: Ron Garret | last post by:
I'm trying to figure out how to use BaseHTTPServer. Here's my little test app: ================================= #!/usr/bin/python from BaseHTTPServer import * import cgi
0
by: samwyse | last post by:
I've just now submitted two issues to the issue tracker: 1491 BaseHTTPServer incorrectly implements response code 100 RFC 2616 sec 8.2.3 states, "An origin server that sends a 100...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.