1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
5 This demonstrates a web server which can run behind a name-based virtual hosting
6 reverse proxy. It decodes modified URLs like:
8 host:port/vhost/http/external-host:port/
10 and dispatches the request as if it had been received on the given protocol,
11 external host, and port.
17 from twisted.internet import reactor
18 from twisted.web import static, server, vhost, twcgi, script
20 root = static.File("static")
22 '.cgi': twcgi.CGIScript,
23 '.epy': script.PythonScript,
24 '.rpy': script.ResourceScript,
26 root.putChild('vhost', vhost.VHostMonsterResource())
27 site = server.Site(root)
28 reactor.listenTCP(1999, site)