corsfix
This commit is contained in:
parent
3af4c1ac7a
commit
2aefcd2708
|
@ -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; }" }}
|
{{ $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 {
|
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 "";
|
default "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ async def check_auth(req):
|
||||||
host = req.headers.get('host', '')
|
host = req.headers.get('host', '')
|
||||||
logger.debug(f"check_auth: host={host}")
|
logger.debug(f"check_auth: host={host}")
|
||||||
auth_url = AUTH_URL
|
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"
|
auth_url = "https://auth.dscrs.site/graphql"
|
||||||
user_id = ""
|
user_id = ""
|
||||||
user_roles = []
|
user_roles = []
|
||||||
|
@ -153,7 +153,7 @@ def login_accepted(f):
|
||||||
info.context["author"] = author.dict()
|
info.context["author"] = author.dict()
|
||||||
else:
|
else:
|
||||||
logger.error(
|
logger.error(
|
||||||
f"login_accepted: Профиль автора не найден для пользователя {user_id}. Исп<EFBFBD><EFBFBD>льзуем базовые данные."
|
f"login_accepted: Профиль автора не найден для пользователя {user_id}. Используем базовые данные."
|
||||||
) # Используем базовую информацию об автор
|
) # Используем базовую информацию об автор
|
||||||
else:
|
else:
|
||||||
logger.debug("login_accepted: Пользователь не авторизован. Очищаем контекст.")
|
logger.debug("login_accepted: Пользователь не авторизован. Очищаем контекст.")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user