Hi,<br><br>I am using web2 to run a cherrypy server at the root of the site using WSGI.<br><br>I&#39;ve got a nearly working set up, the only problem is that when a request comes in for the root of the site, it gets redirected
<br>back to itself:<br>% curl <a href="http://localhost:8080">http://localhost:8080</a><br>This resource resides temporarily at &lt;a href=&#39;<a href="http://localhost:8080/&#39;">http://localhost:8080/&#39;</a>&gt;<a href="http://localhost:8080/">
http://localhost:8080/</a>&lt;/a&gt;<br><br>Intriguingly, if I request locations below the root, things work more OK:<br>% curl <a href="http://localhost:8080/test/index">http://localhost:8080/test/index</a><br><br>then it works OK, even though I am registering the cherrypy at the root of the site.
<br><br>I&#39;ve experimented, and if I register the cherrypy site in a subdir, everything works normally as expected!<br><br>Here&#39;s the code that puts it at the root of the site.&nbsp; I&#39;ve tested this code with a basic WSGI app,
<br>and it works OK.&nbsp; Only cherrypy seems to have this problem.&nbsp; One clue is that the logger shows<br>that the URL being requested is &#39;//&#39; instead of &#39;/&#39;:<br><br>2007-03-18 19:07:02-0700 [HTTPChannel,6,<a href="http://127.0.0.1">
127.0.0.1</a>] <a href="http://127.0.0.1">127.0.0.1</a> - - [18/Mar/2007:19:07:02] &quot;GET // HTTP/1.1&quot; 302 97 &quot;&quot; &quot;curl/7.15.1 (i686-suse-linux) libcurl/7.15.1 OpenSSL/0.9.8a zlib/1.2.3 libidn/0.6.0&quot;
<br><br>Here&#39;s the nearly working test example:<br><br><br>from twisted.application import service, strports<br>from twisted.web2 import server, channel<br>from twisted.web2 import log<br>from twisted.web2 import wsgi
<br>from twisted.web2.wsgi import WSGIResource<br>from cherrypy._cpwsgi import wsgiApp<br>import cherrypy<br><br>## Basic cherrypy index object that dumps the WSGI environment<br>class Root(object):<br>&nbsp;&nbsp;&nbsp; @cherrypy.expose
<br>&nbsp;&nbsp;&nbsp; def index(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s = []<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for key in cherrypy.request.wsgi_environ:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s.append(&quot;%s=%s&lt;br/&gt;&quot; % (key, cherrypy.request.wsgi_environ[key]))<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return &quot;&quot;.join(s)
<br><br>## Run this site using &quot;twistd -noy&quot;<br>if __name__ == &#39;__builtin__&#39;:<br><br>&nbsp;&nbsp;&nbsp; ## Create an instance of the root object and mount it at /<br>&nbsp;&nbsp;&nbsp; r = Root()<br>&nbsp;&nbsp;&nbsp; cherrypy.tree.mount(r, &#39;/&#39;)
<br>&nbsp;&nbsp;&nbsp; wsgi = wsgi.WSGIResource(wsgiApp)<br><br>&nbsp;&nbsp;&nbsp; ## Set up the cherrypy environment<br>&nbsp;&nbsp;&nbsp; cherrypy.config.update({<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;server.environment&#39;:&#39;production&#39;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;server.socketHost&#39;:&#39;
<a href="http://127.0.0.1">127.0.0.1</a>&#39;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; })<br><br>&nbsp;&nbsp;&nbsp; ## Start the cherrypy server; don&#39;t actually run an HTTP server, though<br>&nbsp;&nbsp;&nbsp; cherrypy.server.start(initOnly=True, serverClass=None)<br><br>&nbsp;&nbsp;&nbsp; ## Setup default common access logging
<br>&nbsp;&nbsp;&nbsp; res = log.LogWrapperResource(wsgi)<br>&nbsp;&nbsp;&nbsp; log.DefaultCommonAccessLoggingObserver().start()<br><br>&nbsp;&nbsp;&nbsp; # Create twisted web2 site<br>&nbsp;&nbsp;&nbsp; site = server.Site(res)<br>&nbsp;&nbsp;&nbsp; application = service.Application(&quot;demo&quot;)
<br><br>&nbsp;&nbsp;&nbsp; ## Launch the HTTP site at port 8080<br>&nbsp;&nbsp;&nbsp; s = strports.service(&#39;tcp:8080&#39;, channel.HTTPFactory(site))<br>&nbsp;&nbsp;&nbsp; s.setServiceParent(application)<br>&nbsp;&nbsp;&nbsp; <br><br>