Skip to content

Commit

Permalink
Add a note on how root_path should be used
Browse files Browse the repository at this point in the history
This follows WSGI, as root_path is considered the equivalent to
SCRIPT_NAME and ensures that the root_path can be used as a global
prefix to all routes in the application.
  • Loading branch information
pgjones committed Jan 22, 2021
1 parent cf99cb7 commit 973ec47
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions specs/www.rst
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,24 @@ with the close code passed in the message (or 1000 if none is specified).
spec. Optional; if missing defaults to ``1000``.


Path, raw_path and root_path
----------------------------

The ``raw_path`` is the path component of the request target, which is
then decoded and unquoted to form an initial path. The ``root_path``
(defaults to ``""``) prefix is removed from the initial path to create
the ``path``. If this isn't possible, or the ``path`` does not start
with a ``/`` the server must respond with a 404 response. For example,

Request target root_path 404? path
============== ========= ==== ========
/foo/bar "" No /foo/bar
/foo/bar /foo No /bar
/foo/bar /bar Yes
/foo/bar /foo/bar Yes
/foo/bar/ /foo/bar No /


WSGI Compatibility
------------------

Expand Down

0 comments on commit 973ec47

Please sign in to comment.