Ticket #5807 enhancement new

Opened 10 months ago

Last modified 9 months ago

something in twisted.web should respect (x-)forwarded-for on the server side

Reported by: glyph Owned by:
Priority: normal Milestone:
Component: web Keywords:
Cc: allister.macleod@… Branch:
Author: Launchpad Bug:

Description (last modified by glyph) (diff)

This should work vaguely the same way that twisted.web.vhost.VHostMonsterResource works.

  • Request.getHost() should return the forwarded-for host rather than the Host:.
  • Request.isSecure should return the security of the  proto parameter

Like VHostMonster, there should be some configuration required to get into this mode. One mechanism for doing that would be to have a ForwardedForParserResource; however, since the connecting address is quite important, it may also be reasonable to build this directly into Site. Trusting random forwarded-for headers off the internet would not be good, so it should be easy to specify what the address of the expected terminating proxy is.

Also, forwarded-for is a bit more expressive than the vhostmonster idiom in that it can describe multiple hops. This additional information should be exposed through an explicit API - perhaps a new forwardedFor method on Resource that returns an iterable of objects describing the hosts that it was forwarded through.

See #5806,  http://tools.ietf.org/html/draft-petersson-forwarded-for-02

Change History

1

Changed 10 months ago by glyph

  • component changed from core to web

2

Changed 10 months ago by amacleod

  • cc allister.macleod@… added

3

Changed 10 months ago by glyph

I need to fill this out with some more details; if you want to implement it please comment first so I can fill you in.

4

Changed 9 months ago by glyph

  • description modified (diff)

I think this should be sufficient for a spec. Please comment if you think I should be more specific.

Note: See TracTickets for help on using tickets.