1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

static path prefix fix to support non-root pywb deployment:

- store original wsgi SCRIPT_NAME (before collection path is pushed)
- add 'static_prefix' jinja env global which defaults to original prefix + /static/
- update existing templates to use '{{ static_prefix }}' instead of '{{ host_prefix }}/{{ static_path }''
- set 'pywb.host_prefix' via rewriterapp, set 'static_prefix' to absolute url if available (to support proxy mode)
This commit is contained in:
Ilya Kreymer 2018-07-24 18:25:30 -07:00 committed by John Berlin
parent af3e9c6293
commit 465195f203
No known key found for this signature in database
GPG Key ID: 6EF5E4B442011B02
3 changed files with 6 additions and 1 deletions

View File

@ -494,6 +494,9 @@ class FrontEndApp(object):
# store original script_name (original prefix) before modifications are made
environ['pywb.app_prefix'] = environ.get('SCRIPT_NAME', '')
# store original script_name (original prefix) before modifications are made
environ['ORIG_SCRIPT_NAME'] = environ.get('SCRIPT_NAME')
lang = args.pop('lang', '')
if lang:
pop_path_info(environ)

View File

@ -267,6 +267,8 @@ class RewriterApp(object):
'pywb.static_prefix', '/static/')
is_proxy = ('wsgiprox.proxy_host' in environ)
environ['pywb.host_prefix'] = host_prefix
if self.use_js_obj_proxy:
content_rw = self.js_proxy_rw
else:

View File

@ -3,7 +3,7 @@
{% set urlsplit = cdx.url | urlsplit %}
wbinfo = {};
wbinfo.top_url = "{{ top_url }}";
{% if is_framed %}
{% if is_framed == 'true' %}
// Fast Top-Frame Redirect
if (window == window.top && wbinfo.top_url) {
var loc = window.location.href.replace(window.location.hash, "");