Issue #755 resolved

trailing_slash not working for static files in 3.1 beta

created an issue

In response to ticket 689, a fix was added in 3.0 to cause CherryPy to add a trailing_slash for static as well as dynamic index handlers. That fix doesn't seem to have made it into the 3.1 beta. At least I'm not getting redirects for URLs to static directories that lack a trailing slash. Just in case it matters, I'll point out that the directories that are generating this bad behavior have a different staticdir.index property than is specified in my global config.

Comments (6)

  1. ricardo reporter

    The problem arises in 3.1 (beta 3) when static directories are combined with the new VirtualHost WSGI middleware.

    I added the following to after line 55:

      test_app_conf = {
      rootApp = cherrypy.Application(root)
      testApp = cherrypy.Application(Static())
      vhostmap = {'':testApp}
      vhost = cherrypy._cpwsgi.VirtualHost(rootApp, vhostmap)

    Then I modified lines 106 and 111 respectively to include a Host header:

      self.getPage("/test/", [('Host', '')])
      self.getPage("/test", [('Host', '')])

    With these changes, the test suite fails at (the current) line 113, as one would expect if a missing trailing slash isn't getting added automatically.

  2. Log in to comment