From ee3541d74ed372272a2008a50db39c386d40736c Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sat, 4 Jul 2020 13:35:08 +0200 Subject: [PATCH] Fix kobo links for reverse proxies with subdomains (and docker?) #1470 --- cps/kobo.py | 4 +--- cps/reverseproxy.py | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cps/kobo.py b/cps/kobo.py index 97d55db0..69708d0c 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -19,8 +19,6 @@ import base64 import datetime -import itertools -import json import sys import os import uuid @@ -267,7 +265,7 @@ def HandleMetadataRequest(book_uuid): def get_download_url_for_book(book, book_format): if not current_app.wsgi_app.is_proxied: - if ':' in request.host and not request.host.endswith(']') : + if ':' in request.host and not request.host.endswith(']'): host = "".join(request.host.split(':')[:-1]) else: host = request.host diff --git a/cps/reverseproxy.py b/cps/reverseproxy.py index 42b64050..3bcbd3b7 100644 --- a/cps/reverseproxy.py +++ b/cps/reverseproxy.py @@ -77,6 +77,7 @@ class ReverseProxied(object): servr = environ.get('HTTP_X_FORWARDED_HOST', '') if servr: environ['HTTP_HOST'] = servr + self.proxied = True return self.app(environ, start_response) @property