1
我在本地主机上运行端口8001上的twisted.web.server,并使用mod_proxy运行apache2。 Apache是根据下面的配置设置为代理apache后面的扭曲的web服务器 - 找不到资源
http://localhost/jarvis ----> http://localhost:8001/
该规则的httpd的配置是
ProxyPass /jarvis http://localhost:8001/
ProxyPassReverse /jarvis http://localhost:8001/
扭曲的应用程序的服务器的配置的代码片段如下:
if __name__ == '__main__':
root = Resource()
root.putChild("clientauth", boshProtocol())
logging.basicConfig()
factory = Site(root)
reactor.listenTCP(8001, factory)
reactor.run()
当我去
http://localhost:8001/clientauth
它按预期运行。 然而,当我使用
http://localhost/jarvis/clientauth
它给错误 - “没有这样子的资源。” 据我所知 - 请求被正确代理到扭曲的Web服务器。但为什么儿童资源没有被识别?
您是否打印出您在Twisted'request'中收到的URL?这听起来像它是通过它扭曲而无需删除/ jarvis,所以你正在接收整个网址 –
我们如何做到这一点?你能否详细说明一下。 – mlakhara
关闭我的头部子类的顶部类型twisted.web.resource.Resource创建Site对象作为参数,并在getChild()函数中打印请求。不完全是你的后,但你可以推断:[例子](http://twistedmatrix.com/documents/current/web/howto/web-in-60/dynamic-dispatch.html) –