diff --git a/pywb/apps/frontendapp.py b/pywb/apps/frontendapp.py index 3b0b46dc..e740aa1a 100644 --- a/pywb/apps/frontendapp.py +++ b/pywb/apps/frontendapp.py @@ -357,6 +357,9 @@ class FrontEndApp(object): try: endpoint, args = urls.match() + # store original script_name (original prefix) before modifications are made + environ['pywb.app_prefix'] = environ.get('SCRIPT_NAME') + response = endpoint(environ, **args) return response(environ, start_response) diff --git a/pywb/apps/rewriterapp.py b/pywb/apps/rewriterapp.py index 13397561..b467c804 100644 --- a/pywb/apps/rewriterapp.py +++ b/pywb/apps/rewriterapp.py @@ -256,6 +256,8 @@ class RewriterApp(object): urlkey = canonicalize(wb_url.url) + environ['pywb.host_prefix'] = host_prefix + if self.use_js_obj_proxy: content_rw = self.js_proxy_rw else: diff --git a/pywb/rewrite/templateview.py b/pywb/rewrite/templateview.py index 74b1c9c0..c972bb87 100644 --- a/pywb/rewrite/templateview.py +++ b/pywb/rewrite/templateview.py @@ -139,7 +139,10 @@ class BaseInsertView(object): params = env.get(self.jenv.env_template_params_key) if params: kwargs.update(params) + kwargs['env'] = env + kwargs['static_prefix'] = env.get('pywb.host_prefix', '') + env.get('pywb.app_prefix', '') + '/static' + return template.render(**kwargs) diff --git a/pywb/templates/banner.html b/pywb/templates/banner.html index dffe1057..d240b9da 100644 --- a/pywb/templates/banner.html +++ b/pywb/templates/banner.html @@ -1,5 +1,5 @@ {% if not env.pywb_proxy_magic or config.proxy.use_banner | default(true) %} - - + + {% endif %} diff --git a/pywb/templates/frame_insert.html b/pywb/templates/frame_insert.html index b8fbe1bb..1f7e74e1 100644 --- a/pywb/templates/frame_insert.html +++ b/pywb/templates/frame_insert.html @@ -12,7 +12,7 @@ html, body } - + {{ banner_html }} diff --git a/pywb/templates/head_insert.html b/pywb/templates/head_insert.html index 78a198cd..3eb7fe45 100644 --- a/pywb/templates/head_insert.html +++ b/pywb/templates/head_insert.html @@ -23,11 +23,11 @@ wbinfo.is_live = {{ is_live }}; wbinfo.coll = "{{ coll }}"; wbinfo.proxy_magic = "{{ env.pywb_proxy_magic }}"; - wbinfo.static_prefix = "{{ host_prefix }}/{{ static_path }}/"; + wbinfo.static_prefix = "{{ static_prefix }}/"; {% if not wb_url.is_banner_only %} - + + {% endif %} {{ banner_html }} diff --git a/pywb/templates/index.html b/pywb/templates/index.html index ae1456ce..641d4701 100644 --- a/pywb/templates/index.html +++ b/pywb/templates/index.html @@ -8,7 +8,7 @@ This archive contains the following collections: