From 6384cdc74d8781f981f7e5393d130bbcb44a5b7f Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 19 Apr 2020 19:53:41 +0800 Subject: [PATCH] Fix https github oauth while using https domian and nginx as proxy, a `ProxyFix` is required. --- cps/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cps/__init__.py b/cps/__init__.py index 1791098f..15820b86 100755 --- a/cps/__init__.py +++ b/cps/__init__.py @@ -36,7 +36,7 @@ from flask_principal import Principal from . import logger, cache_buster, cli, config_sql, ub, db, services from .reverseproxy import ReverseProxied from .server import WebServer - +from werkzeug.middleware.proxy_fix import ProxyFix mimetypes.init() mimetypes.add_type('application/xhtml+xml', '.xhtml') @@ -77,7 +77,7 @@ log = logger.create() def create_app(): - app.wsgi_app = ReverseProxied(app.wsgi_app) + app.wsgi_app = ReverseProxied(ProxyFix(app.wsgi_app, x_for=1, x_host=1)) # For python2 convert path to unicode if sys.version_info < (3, 0): app.static_folder = app.static_folder.decode('utf-8')