From 6211c7187589ffcad6a6521ef1573047048a58a0 Mon Sep 17 00:00:00 2001 From: jar3b Date: Wed, 25 Nov 2020 16:25:04 +0300 Subject: [PATCH] fix: detect `x-forwarded-proto` if deployed behind proxy For static files handling, was set up in "oas_ui()" --- aiohttp_pydantic/oas/view.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aiohttp_pydantic/oas/view.py b/aiohttp_pydantic/oas/view.py index 8523391..699a72c 100644 --- a/aiohttp_pydantic/oas/view.py +++ b/aiohttp_pydantic/oas/view.py @@ -172,6 +172,8 @@ async def oas_ui(request): static_url = request.app.router["static"].url_for(filename="") spec_url = request.app.router["spec"].url_for() + if request.scheme != request.headers.get('x-forwarded-proto', request.scheme): + request = request.clone(scheme=request.headers['x-forwarded-proto']) host = request.url.origin() return Response(