cors-connect

This commit is contained in:
Untone 2023-10-11 14:39:08 +03:00
parent c468500109
commit a395e4e55d
2 changed files with 6 additions and 1 deletions

View File

@ -51,6 +51,10 @@ server {
# Custom location block for /connect # Custom location block for /connect
location /connect { location /connect {
proxy_pass http://presence-8080; proxy_pass http://presence-8080;
{{ $cors_headers_options }}
{{ $cors_headers_post }}
{{ $cors_headers_get }}
} }
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ { location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {

View File

@ -3,11 +3,12 @@ from httpx import AsyncClient, HTTPError
from settings import AUTH_URL from settings import AUTH_URL
INTERNAL_AUTH_SERVER = "v2.discours" in AUTH_URL INTERNAL_AUTH_SERVER = "v2.discours" in AUTH_URL or "testapi.discours" in AUTH_URL
async def check_auth(req): async def check_auth(req):
token = req.headers.get("Authorization") token = req.headers.get("Authorization")
print(f"[services.auth] checking auth token: {token}")
gql = ( gql = (
{"mutation": "{ getSession { user { id } } }"} {"mutation": "{ getSession { user { id } } }"}
if INTERNAL_AUTH_SERVER if INTERNAL_AUTH_SERVER