'Check to see if this is a reverse proxied connection.'

def allHeadersReceived(self):

    CLIENT = 0
    http.HTTPChannel.allHeadersReceived(self)
    req = self.requests[(-1)]
    (client_ip, port) = self.transport.client
    proxy_chain = req.getHeader('X-FORWARDED-FOR')
    if (proxy_chain and (client_ip in _UPSTREAM_IPS)):
        forwarded = proxy_chain.split(',    ', 1)[CLIENT]
        self.transport.client = (forwarded, port)
