Skip to content

Commit 65a439e

Browse files
committed
fix(engine): HttpsRedirectMiddleware without using cloud functions
Previously, using HttpsRedirectMiddleware without cloud functions or hooks (not calling engine.wrap) will cause cloud function health check failure. Thanks [magine] for bringing this to our attention. [magine]: https://forum.leancloud.cn/t/python-web/22582 [magine]: https://forum.leancloud.cn/t/python-web/22582
1 parent a6e16be commit 65a439e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

leancloud/engine/https_redirect_middleware.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def __init__(self, wsgi_app):
2222

2323
def __call__(self, environ, start_response):
2424
request = Request(environ)
25-
if is_prod and request.headers.get('X-Forwarded-Proto') != 'https':
25+
engine_health = '/1.1/functions/_ops/metadatas'
26+
if is_prod and request.path != engine_health and request.headers.get('X-Forwarded-Proto') != 'https':
2627
url = 'https://{0}{1}'.format(request.host, request.full_path)
2728
return redirect(url)(environ, start_response)
2829

0 commit comments

Comments
 (0)