[Moin-devel] [ moin-Patches-1100206 ] Twisted reverse proxy support

SourceForge.net noreply at sourceforge.net
Sun Jan 23 05:42:10 EST 2005


Patches item #1100206, was opened at 2005-01-11 16:10
Message generated for change (Comment added) made by thomaswaldmann
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=308482&aid=1100206&group_id=8482

Category: None
Group: None
Status: Open
Resolution: None
Priority: 6
Submitted By: Thomas Werschlein (twerschlein)
Assigned to: Nobody/Anonymous (nobody)
Summary: Twisted reverse proxy support

Initial Comment:
I run twistedmoin behind an Apache reverse proxy using
mod_proxy. Everything works fine, but the RSS feed
shows the internal host/port as source instead of the
published URL (i.e. the reverse proxy host/port).

adding these two lines to MoinRequest(server.Request):

  if getattr(config, 'proxyhost', None) and
getattr(config, 'proxyport', None):
     self.setHost(config.proxyhost, config.proxyport,
ssl=getattr(config, 'proxyssl', 0))

after
  self.host = self.channel.transport.getHost()

in
  MoinMoin/server/twistedmoin.py

seems to solve the problem. Obviously, this is a quick
and dirty hack and I am not sure, if this has some bad
side effects I am not aware of. I am also not sure, if
it is the right place to do it. And, of course it would
be better to include some default settings in the
Config class for the new config attributes proxyhost,
proxyport and proxyssl instead of the getattr quirk.

BTW, this is the docstring of setHost in
twisted/protocols/http.py:
"""Change the host and port the request thinks it's
using. This method is useful for working with reverse
HTTP proxies (e.g. both Squid and Apache's mod_proxy
can do this), then the address the HTTP client is using
is different than the one we're listening on.
For example, Apache may be listening on
https://www.example.com, and then forwarding requests
to http://localhost:8080, but we don't want HTML
produced by Twisted to say 'http://localhost:8080',
they should say 'https://www.example.com', so we do::
  request.setHost('www.example.com', 443, ssl=1)
This method is experimental.
"""

----------------------------------------------------------------------

>Comment By: Thomas Waldmann (thomaswaldmann)
Date: 2005-01-23 14:41

Message:
Logged In: YES 
user_id=100649

the current 1.3 development version (soon to be released as
1.3.2) uses such code only for POST.

so i think your patch can't be applied there.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=308482&aid=1100206&group_id=8482




More information about the Moin-devel mailing list