Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion aim/web/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from fastapi.exceptions import HTTPException
from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.gzip import GZipMiddleware
from starlette.middleware.csrf import CSRFMiddleware


def create_app():
Expand All @@ -18,11 +19,14 @@ def create_app():
CORSMiddleware,
allow_origins=['*'],
allow_methods=['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD'],
allow_headers=['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization', 'X-Timezone-Offset'],
allow_headers=['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization', 'X-Timezone-Offset', 'X-CSRF-Token'],
allow_credentials=True,
max_age=86400,
)

# Add CSRF protection middleware
app.add_middleware(CSRFMiddleware, secret_key="aim-web-api-csrf-secret-key-2024")

from aim.web.api.dashboard_apps.views import dashboard_apps_router
from aim.web.api.dashboards.views import dashboards_router
from aim.web.api.experiments.views import experiment_router
Expand Down