1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-25 01:20:32 +00:00

Fix kobo links for reverse proxies with subdomains (and docker?) #1470

This commit is contained in:
Ozzieisaacs 2020-07-04 13:35:08 +02:00
parent 8608ff11f7
commit ee3541d74e
2 changed files with 2 additions and 3 deletions

View File

@ -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

View File

@ -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