我有一个sockjs服务器在haproxy后面。现在我需要一个客户端的ip地址,但是使用self.transport.getPeer()
我得到了我的haproxy的ip。Haproxy向请求添加了一个X-Forward-For头,其中包含原始客户端的ip。在
如何获取协议中已发送到服务器的原始http请求?在
class MyProtocol(LineReceiver):
def connectionMade(self):
# this next line only gives me the ip of my proxy
ip = self.transport.getPeer()
class MyFactory(protocol.ServerFactory):
protocol = MyProtocol
my_factory = MyFactory()
sockjs_factory = SockJSMultiFactory()
sockjs_factory.addFactory(my_factory, 'echo')
sockjs_service = internet.TCPServer(10000, sockjs_factory)
application = service.Application("frog32")
sockjs_service.setServiceParent(application)
目前没有回答
相关问题 更多 >
编程相关推荐