[Twisted-Python] Web Proxy that does something different once a day
sam at spinwardstars.com
Fri Sep 21 15:45:09 EDT 2007
>Hoping someone else chimes in with how to stick a redirect into a proxy,
Nothing to do with Twisted, per se.
A proxy is a two-way conduit:
1. Receive a request from A
2. Massage and/or log the request as necessary
3. Make a request to B.
4. Receive the response from B.
5. Massage and/or log the response as necessary
6. Return the response to A.
It looks like this is just for the web browsers
(i.e., HTTP protocol). If so, then at step 2
you would make your test. If you decide A should
go to the "required reading" URL instead of the
requested URL, simply skip steps 3-5 and return
a valid HTTP document with a "moved temporarily"
code (30x, I think). The browser will then request
the other URL. The one catch is that, depending on
the browser, the user may get the same page if they
request the original URL again in the same browser
window/session. If that's the case, they would need
to open a new window to get to the original URL.
More information about the Twisted-Python