From 30684be056be3ec10a8db9e5d569096563404006 Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 10 May 2019 17:36:03 -0400 Subject: [PATCH 1/2] stop depending on fake headers appears to be used only in setting bibref urls and in opengraph metadata --- BaseSearcher.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/BaseSearcher.py b/BaseSearcher.py index 79eddee..202a920 100644 --- a/BaseSearcher.py +++ b/BaseSearcher.py @@ -420,19 +420,21 @@ class OpenSearch (object): host = cherrypy.request.headers.get ('X-Forwarded-Host', cherrypy.config['host']) self.host = host.split (',')[-1].strip () # keep only the last hub + # turns out X-Forwarded-Protocol (X-Forwarded-Proto is the defacto standaard) + # is not a thing and has to be set in HAProxy self.protocol = cherrypy.request.headers.get ('X-Forwarded-Protocol', 'https') # sanity check if self.host not in (cherrypy.config['all_hosts']): self.host = cherrypy.config['host'] if self.protocol not in VALID_PROTOCOLS: - self.protocol = 'http' + self.protocol = 'https' self.urlgen = routes.URLGenerator ( cherrypy.routes_mapper, { 'HTTP_HOST': self.host, - 'HTTPS': 1 if self.protocol == 'https' else 0, + 'HTTPS': 1 , } ) @@ -898,7 +900,7 @@ class OpenSearch (object): def format_canonical_bibrec_url (self, row): """ Generate the rel=canonical bibrec url for a book. """ - return self.url ('bibrec', host = self.file_host, protocol = 'http', id = row.pk, format = None) + return self.url ('bibrec', host = self.file_host, protocol = 'https', id = row.pk, format = None) def format_thumb_url (self, row): """ Generate the thumb url in results. """ From f365ad8005a202847c72bdfce9f9a075f52b471a Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 10 May 2019 17:36:46 -0400 Subject: [PATCH 2/2] https updates to outgoing links --- templates/site-layout.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/site-layout.html b/templates/site-layout.html index 1522e82..bc36baa 100644 --- a/templates/site-layout.html +++ b/templates/site-layout.html @@ -80,24 +80,24 @@
Credits
-

This web site uses only free software.

- - - @@ -114,7 +114,7 @@