From 8faa5e2a82f7f70fb1dbb1ad9c1afbdf7467d862 Mon Sep 17 00:00:00 2001 From: Ray Luo Date: Mon, 22 Jul 2019 23:41:23 -0700 Subject: [PATCH] Better https detection Switch to request.is_https which provides better https detection --- gluon/rewrite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gluon/rewrite.py b/gluon/rewrite.py index 526e2a10..48c1535b 100644 --- a/gluon/rewrite.py +++ b/gluon/rewrite.py @@ -204,7 +204,7 @@ def url_out(request, environ, application, controller, function, if host is True or (host is None and (scheme or port is not None)): host = request.env.http_host if not scheme or scheme is True: - scheme = request.env.get('wsgi_url_scheme', 'http').lower() if request else 'http' + scheme = 'https' if request and request.is_https else 'http' if host: host_port = host if not port else host.split(':', 1)[0] + ':%s' % port url = '%s://%s%s' % (scheme, host_port, url)