diff --git a/nginx.conf.sigil b/nginx.conf.sigil index 324f8a58..9c0266ae 100644 --- a/nginx.conf.sigil +++ b/nginx.conf.sigil @@ -6,7 +6,7 @@ {{ $cors_headers_get := "if ($request_method = 'GET') { add_header 'Access-Control-Allow-Origin' '$allow_origin' always; add_header 'Access-Control-Allow-Credentials' 'true' always; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always; add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; }" }} map $http_origin $allow_origin { - ~^https?:\/\/((.*\.)?localhost:3000|(.*\.)?dscrs\.site|testingdiscoursio-git-.*-discoursio\.vercel\.app|(.*\.)?discours\.io)$ $http_origin; + ~^https?:\/\/((.*\.)?localhost(:\d+)?|(.*\.)?dscrs\.site|testingdiscoursio-git-.*-discoursio\.vercel\.app|(.*\.)?discours\.io|testing\.dscrs\.site)$ $http_origin; default ""; } diff --git a/services/auth.py b/services/auth.py index c5f3b87b..88d7099b 100644 --- a/services/auth.py +++ b/services/auth.py @@ -25,7 +25,7 @@ async def check_auth(req): host = req.headers.get('host', '') logger.debug(f"check_auth: host={host}") auth_url = AUTH_URL - if host == 'testing.dscrs.site' or host == 'localhost:3000': + if 'testing.dscrs.site' in host or 'localhost' in host: auth_url = "https://auth.dscrs.site/graphql" user_id = "" user_roles = [] @@ -153,7 +153,7 @@ def login_accepted(f): info.context["author"] = author.dict() else: logger.error( - f"login_accepted: Профиль автора не найден для пользователя {user_id}. Исп��льзуем базовые данные." + f"login_accepted: Профиль автора не найден для пользователя {user_id}. Используем базовые данные." ) # Используем базовую информацию об автор else: logger.debug("login_accepted: Пользователь не авторизован. Очищаем контекст.")