Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1655

Show
Ignore:
Timestamp:
05/04/07 13:03:30
Author:
fumanchu
Message:

Better docstring for cherrypy.dispatch.VirtualHost?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cpdispatch.py

    r1625 r1655  
    347347    """Select a different handler based on the Host header. 
    348348     
    349     Useful when running multiple sites within one CP server. 
    350      
    351     From http://groups.google.com/group/cherrypy-users/browse_thread/thread/f393540fe278e54d: 
    352      
    353     For various reasons I need several domains to point to different parts of a 
    354     single website structure as well as to their own "homepage"   EG 
    355      
    356     http://www.mydom1.com  ->  root 
    357     http://www.mydom2.com  ->  root/mydom2/ 
    358     http://www.mydom3.com  ->  root/mydom3/ 
    359     http://www.mydom4.com  ->  under construction page 
    360      
    361     but also to have  http://www.mydom1.com/mydom2/  etc to be valid pages in 
    362     their own right. 
     349    This can be useful when running multiple sites within one CP server. 
     350    It allows several domains to point to different parts of a single 
     351    website structure. For example: 
     352     
     353        http://www.mydom1.com  ->  root 
     354        http://www.mydom2.com  ->  root/mydom2/ 
     355        http://www.mydom2.com:443  ->  root/secure 
     356     
     357    can be accomplished via: 
     358     
     359        request.dispatch = cherrypy.dispatch.VirtualHost( 
     360            **{'www.mydom2.com': '/mydom2', 
     361               'www.mydom2.com:443': '/secure', 
     362              }) 
     363     
     364    next_dispatcher: the next dispatcher object in the dispatch chain. 
     365        The VirtualHost dispatcher adds a prefix to the URL and calls 
     366        another dispatcher. Defaults to cherrypy.dispatch.Dispatcher(). 
     367     
     368    use_x_forwarded_host: if True (the default), any "X-Forwarded-Host" 
     369        request header will be used instead of the "Host" header. This 
     370        is commonly added by HTTP servers (such as Apache) when proxying. 
     371     
     372    **domains: a dict of {host header value: virtual prefix} pairs. 
     373        The incoming "Host" request header is looked up in this dict, 
     374        and, if a match is found, the corresponding "virtual prefix" 
     375        value will be prepended to the URL path before calling the 
     376        next dispatcher. Note that you often need separate entries 
     377        for "mysite.com" and "www.mysite.com". In addition, "Host" 
     378        headers may contain the port number. 
    363379    """ 
    364380    from cherrypy.lib import http 

Hosted by WebFaction

Log in as guest/cpguest to create tickets