Commit 6fabb64f authored by novelailab's avatar novelailab

CORS

parent 634acf6e
from fastapi import FastAPI, Request from fastapi import FastAPI, Request
from pydantic import BaseModel from pydantic import BaseModel
from fastapi.responses import HTMLResponse, PlainTextResponse from fastapi.responses import HTMLResponse, PlainTextResponse
from fastapi.middleware.cors import CORSMiddleware
from sentry_sdk import capture_exception from sentry_sdk import capture_exception
from sentry_sdk import capture_message from sentry_sdk import capture_message
from sentry_sdk import start_transaction from sentry_sdk import start_transaction
...@@ -28,6 +29,14 @@ sent_first_message = False ...@@ -28,6 +29,14 @@ sent_first_message = False
#Initialize fastapi #Initialize fastapi
app = FastAPI() app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=False,
allow_methods=["*"],
allow_headers=["*"],
)
@app.on_event("startup") @app.on_event("startup")
def startup_event(): def startup_event():
logger.info("FastAPI Started, serving") logger.info("FastAPI Started, serving")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment