diff --git a/backend/src/kwai/frontend/apps/_auth.py b/backend/src/kwai/frontend/apps/_auth.py index e2d74744..89e982b0 100644 --- a/backend/src/kwai/frontend/apps/_auth.py +++ b/backend/src/kwai/frontend/apps/_auth.py @@ -29,12 +29,16 @@ async def get_app( if asset_file_path is not None: return EtagFileResponse(asset_file_path) + url = request.url_for(APP_NAME, path="") + if "x-forwarded-proto" in request.headers: + url = url.replace(scheme=request.headers["x-forwarded-proto"]) + return templates.TemplateResponse( "index.jinja2", { "application": { "name": APP_NAME, - "url": str(request.url_for(APP_NAME, path="")), + "url": str(url), }, "request": request, "vite": vite, diff --git a/backend/src/kwai/frontend/apps/_author.py b/backend/src/kwai/frontend/apps/_author.py index 3c7a16b7..71faf620 100644 --- a/backend/src/kwai/frontend/apps/_author.py +++ b/backend/src/kwai/frontend/apps/_author.py @@ -29,12 +29,16 @@ async def get_app( if asset_file_path is not None: return EtagFileResponse(asset_file_path) + url = request.url_for(APP_NAME, path="") + if "x-forwarded-proto" in request.headers: + url = url.replace(scheme=request.headers["x-forwarded-proto"]) + return templates.TemplateResponse( "index.jinja2", { "application": { "name": APP_NAME, - "url": str(request.url_for(APP_NAME, path="")), + "url": str(url), }, "request": request, "vite": vite, diff --git a/backend/src/kwai/frontend/apps/_club.py b/backend/src/kwai/frontend/apps/_club.py index 17970f78..fa490c7c 100644 --- a/backend/src/kwai/frontend/apps/_club.py +++ b/backend/src/kwai/frontend/apps/_club.py @@ -29,12 +29,16 @@ async def get_app( if asset_file_path is not None: return EtagFileResponse(asset_file_path) + url = request.url_for(APP_NAME, path="") + if "x-forwarded-proto" in request.headers: + url = url.replace(scheme=request.headers["x-forwarded-proto"]) + return templates.TemplateResponse( "index.jinja2", { "application": { "name": APP_NAME, - "url": str(request.url_for(APP_NAME, path="")), + "url": str(url), }, "request": request, "vite": vite, diff --git a/backend/src/kwai/frontend/apps/_coach.py b/backend/src/kwai/frontend/apps/_coach.py index 103e4103..d2e3c5d0 100644 --- a/backend/src/kwai/frontend/apps/_coach.py +++ b/backend/src/kwai/frontend/apps/_coach.py @@ -29,12 +29,16 @@ async def get_app( if asset_file_path is not None: return EtagFileResponse(asset_file_path) + url = request.url_for(APP_NAME, path="") + if "x-forwarded-proto" in request.headers: + url = url.replace(scheme=request.headers["x-forwarded-proto"]) + return templates.TemplateResponse( "index.jinja2", { "application": { "name": APP_NAME, - "url": str(request.url_for(APP_NAME, path="")), + "url": str(url), }, "request": request, "vite": vite, diff --git a/backend/src/kwai/frontend/apps/_portal.py b/backend/src/kwai/frontend/apps/_portal.py index da3dfca4..a544eee2 100644 --- a/backend/src/kwai/frontend/apps/_portal.py +++ b/backend/src/kwai/frontend/apps/_portal.py @@ -29,12 +29,16 @@ async def get_app( if asset_file_path is not None: return EtagFileResponse(asset_file_path) + url = request.url_for(APP_NAME, path="") + if "x-forwarded-proto" in request.headers: + url = url.replace(scheme=request.headers["x-forwarded-proto"]) + return templates.TemplateResponse( "index.jinja2", { "application": { "name": APP_NAME, - "url": str(request.url_for(APP_NAME, path="")), + "url": str(url), }, "request": request, "vite": vite,