Description
If, for some bizzare reason you, like me, have X-Forwarded-For headers with multiple hosts in them, Moin's redirections will break. It will attempt to redirect you to "http://host1, host2/filepath" I don't have 1.9 yet, and I'm hoping 1.9 won't have this problem. If you're in an earlier version and want a fix, read on....
Steps to reproduce
- get your server to have multiple X-Forwarded-For hosts. I'm behind a few layers of proxies.
- try to render as docbook or do a search with exactly one result - that causes a redirect
Details
To fix it, I edited MoinMoin/request/__init__.py so that the function rewriteHost(self, env) looks like this:
proxy_host = (env.get(self.proxy_host) or env.get(cgiMetaVariable(self.proxy_host))) logging.debug("proxy_host = '%s'" %(proxy_host)) proxy_host = re.sub(r',\s.*','',proxy_host) logging.debug("proxy_host = '%s'" %(proxy_host)) if proxy_host: self.http_host = proxy_host
The only substantive change is the re.sub. I've also added 2 logging.debug lines.
Discussion
Obviously, I'm in 1.8 and 1.9 is current, so this is not very useful to you devs. Mostly I'm hoping this bug report will help someone else who has the same problem.
Plan
- Priority:
- Assigned to:
- Status: