Skip to content

Commit

Permalink
Problem: Diagnostic VM API isn't accessible through frontend.
Browse files Browse the repository at this point in the history
Solution: Implement CORS policy headers on diagnostic VM endpoints.
  • Loading branch information
nesitor authored and MHHukiewitz committed Mar 4, 2024
1 parent 87fc8d7 commit 0453d14
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/example_fastapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import aiohttp
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import PlainTextResponse
from pip._internal.operations.freeze import freeze
from pydantic import BaseModel
Expand All @@ -27,6 +28,13 @@

http_app = FastAPI()
app = AlephApp(http_app=http_app)
app.add_middleware(
CORSMiddleware,
allow_credentials=True,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
)
cache = VmCache()

startup_lifespan_executed: bool = False
Expand Down

0 comments on commit 0453d14

Please sign in to comment.