diff options
author | Chris McDonough <chrism@plope.com> | 2013-08-12 00:59:21 -0400 |
---|---|---|
committer | Chris McDonough <chrism@plope.com> | 2013-08-12 00:59:21 -0400 |
commit | b0d0a059574bda04f7d2daa8888d26a90cc49322 (patch) | |
tree | 32f36f4fc2875f961aa24f1eb4a27d57dfe140e1 | |
parent | ae0e9dcd6e59b62385d599ce2e7254212dcc89f3 (diff) | |
download | waitress-b0d0a059574bda04f7d2daa8888d26a90cc49322.tar.gz |
add url_prefix docs
-rw-r--r-- | docs/index.rst | 21 | ||||
-rw-r--r-- | docs/runner.rst | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/docs/index.rst b/docs/index.rst index c345011..c09566f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -138,6 +138,23 @@ You can have the Waitress server use the ``https`` url scheme by default.:: This works if all URLs generated by your application should use the ``https`` scheme. +Using ``url_prefix`` to influence ``SCRIPT_NAME`` and ``PATH_INFO`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You can have the Waitress server use a particular url prefix by default for all +URLs generated by downstream applications that take ``SCRIPT_NAME`` into +account.:: + + from waitress import serve + serve(wsgiapp, host='0.0.0.0', port=8080, url_prefix='/foo') + +Setting this to any value except the empty string will cause the WSGI +``SCRIPT_NAME`` value to be that value, minus any trailing slashes you add, and +it will cause the ``PATH_INFO`` of any request which is prefixed with this +value to be stripped of the prefix. This is useful in proxying scenarios where +you wish to forward all traffic to a Waitress server but need URLs generated by +downstream applications to be prefixed with a particular path segment. + Using Paste's ``PrefixMiddleware`` to set ``wsgi.url_scheme`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -197,6 +214,10 @@ PasteDeploy-style configuration:: host = 127.0.0.1 port = 8080 +Note that you can also set ``PATH_INFO`` and ``SCRIPT_NAME`` using +PrefixMiddleware too (its original purpose, really) instead of using Waitress' +``url_prefix`` adjustment. See the PasteDeploy docs for more information. + Extended Documentation ---------------------- diff --git a/docs/runner.rst b/docs/runner.rst index dd9e531..3fb3814 100644 --- a/docs/runner.rst +++ b/docs/runner.rst @@ -97,7 +97,7 @@ Common options: ``--url-scheme=STR`` Default ``wsgi.url_scheme`` value, default is 'http'. -` + ``--url-prefix=STR`` The ``SCRIPT_NAME`` WSGI environment value. Setting this to anything except the empty string will cause the WSGI ``SCRIPT_NAME`` value to be the |