Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1199 (closed enhancement: wontfix)

Opened 13 years ago

Last modified 11 years ago

Application mount point != virtual path prefix.

Reported by: tic Owned by: anonymous
Priority: normal Milestone: 1.1
Component: Deployment Version: 1.1 HEAD
Severity: normal Keywords:
Cc: mikael.jansson@…

Description (last modified by Chris Arndt) (diff)

In startup.py, VirtualPathFilter:on_start_resource(), the request's object_path is rewritten using server.webpath, should you want to deploy it somewhere other than at the root ('/').

If you're using FastCGI, however, you want to _strip_ the FastCGI wrapper rather than mount the app there.

So, cherrypy.request.path needs to be rewritten. Also, config.get('server.webpath', False) is wrong, the default value should be ''.

See attachment.


dispatch.fcgi Download (5.0 KB) - added by tic 13 years ago.

Change History

comment:1 Changed 13 years ago by tic

First, disregard attachment:startup.py-virtualpathfilter.diff -- I don't know if that is the correct solution for deploying behind FastCGI and have reverted my local copy. (I don't have the permission to delete it)

I'm using the file dispatch.fcgi, together with a .htaccess file that does a rewrite like this:

RewriteRule     On
RewriteRule     ^(tg-media-wrapper\.fcgi/.*)$        -                       [L]
RewriteRule     ^(.*)$ tg-media-wrapper\.fcgi/$1                             [L]

(tg-media-wrapper.fcgi just sets LD_LIBRARY_PATH and execs dispatch.fcgi)

So: for this, we need to chomp the prefix "tg-media-wrapper.fci" off any request.

request.object_path is neccessary so that the correct URLs are handed over to TurboGears. But, there is a twist to it! When typing in a mounted controller path without a trailing slash, TurboGears will perform a 302 redirect. For this, request.path needs to be stripped, too.

See VirtualPathFilter? in attachment:dispatch.fcgi Download. It chomps off both request.path and request.object_path.

Changed 13 years ago by tic

comment:2 Changed 13 years ago by tic

This is what you'd get without described changes. In A => B, A is what you type in the browser, B is what you see in the URL field after pressing enter.

http://host/mounted_controller/ => http://host/mounted_controller
http://host/mounted_controller => http://host/tg-wrapper.fcgi/mounted_controller

(The third URL internally causes a 302.)

comment:3 Changed 13 years ago by tic

  • Cc mikael.jansson@… added

comment:4 Changed 12 years ago by jorge.vargas

  • Type changed from defect to enhancement

hi sorry for the delay on this.

It seems to be better of as a document describing the process I have added this to  http://docs.turbogears.org/1.0/RoughDocs/DocumentationWishList

I have no idea how to do this so if you could structure it as a tutorial and port it at RoughDocs? I'll make sure it gets into  http://docs.turbogears.org/1.0#id18

Please assign the ticket to me ones this is done.

comment:5 Changed 12 years ago by Chris Arndt

  • Version changed from trunk to 1.1b1
  • Milestone set to __unclassified__

comment:6 Changed 11 years ago by Chris Arndt

  • Status changed from new to closed
  • Version changed from 1.1b1 to 1.1 HEAD
  • Resolution set to wontfix
  • Description modified (diff)
  • Milestone changed from __unclassified__ to 1.1

It seems that this has been fixed/obsoleted with #1919. Also it is recommended to deploy TG apps using mod_wsgi or behind a reverse proxy.

If you disagree and this is still broken in the 1.1 branch HEAD, feel free to re-open the ticket.

Note: See TracTickets for help on using tickets.