[Twisted-web] Twisted to proxy php out to apache?

David Reid dreid at dreid.org
Wed May 24 14:40:45 CDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Remi Cool wrote:
>> Ok, I'm with you with that (I need to read more carefully) ... but what
>> I would like to do, is pass all requests for files ending with .php (and
>> maybe .js and .ccs) to be forwarded to another server. Forwarding
>> everything would make the transition from php to nevow a tad more
>> difficult.  Would this 'selective' proxying be possible?

Well unless you've specifically got long standing URLs to worry about
you should just take whatever static.File you had those php, js, and css
wrapped in before (when you tried CGI) and replace it with a
ReverseProxyResource to the appropriate path on the apache server.  And
then put all the nevow code in a seperate part of the hierarchy for example.

root = someBlankResource()
root.putChild('nevow', MyCoolNevowApplication())
root.putChild('oldapplication', ReverseProxyResource('localhost', 8080,
'/'))

Note that MyCoolNevowApplication can still reference javascript and CSS
being served through /oldapplication by apache via the proxy. You could
even put 'oldapplication' as a child of MyCoolNevowApplication and have
that be your root resource.  But not knowing specifically the url
hierarchy of your currently deployed application I can't give a thorough
opinion on how you should lay these things out.

If your code isnt' easily segmented in this manner then there may not be
an out of the box solution for you.

- -David

- --
"Usually the protocol is this: I appoint someone for a task,
which they are not qualified to do.  Then, they have to fight
a bear if they don't want to do it." -- Glyph Lefkowitz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)

iD8DBQFEdLa9rsrO6aeULcgRAvnPAJ42pehXVlG63OG7Y8l1RCyVNNIE/wCeLq6B
BtS/gF2Edkb3cSfsWmSyeGg=
=uLyl
-----END PGP SIGNATURE-----



More information about the Twisted-web mailing list