kopia lustrzana https://github.com/piku/piku
Merge pull request #367 from pcardoso/feature/catch-all
Adding support for catch-all URLspull/369/head^2
commit
8320f7564f
|
@ -71,6 +71,8 @@ Also, keep in mind that using `nginx` caching with a `static` website worker wil
|
|||
|
||||
* `NGINX_INCLUDE_FILE`: a file in the app's dir to include in nginx config `server` section - useful for including custom `nginx` directives.
|
||||
* `NGINX_ALLOW_GIT_FOLDERS`: (boolean) allow access to `.git` folders (default: false, blocked)
|
||||
* `NGINX_CATCH_ALL` (string, defaults to ""): specifies a filename to serve to all requests regardless of path (useful when using client-side routing)
|
||||
|
||||
|
||||
## Acme Settings
|
||||
|
||||
|
|
4
piku.py
4
piku.py
|
@ -171,7 +171,7 @@ PIKU_INTERNAL_NGINX_STATIC_MAPPING = """
|
|||
directio 8m;
|
||||
aio threads;
|
||||
alias $static_path;
|
||||
try_files $uri $uri.html $uri/ =404;
|
||||
try_files $uri $uri.html $uri/ $catch_all =404;
|
||||
}
|
||||
"""
|
||||
|
||||
|
@ -952,6 +952,8 @@ def spawn_app(app, deltas={}):
|
|||
static_paths = ("/" if stripped[0:1] == ":" else "/:") + (stripped if stripped else ".") + "/" + ("," if static_paths else "") + static_paths
|
||||
if len(static_paths):
|
||||
try:
|
||||
# pylint: disable=unused-variable
|
||||
catch_all = env.get('NGINX_CATCH_ALL', '')
|
||||
items = static_paths.split(',')
|
||||
for item in items:
|
||||
static_url, static_path = item.split(':')
|
||||
|
|
Ładowanie…
Reference in New Issue