Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -312,26 +312,6 @@ from starlette.middleware.cors import CORSMiddleware
|
|
312 |
# Define the FastAPI app
|
313 |
app = FastAPI()
|
314 |
|
315 |
-
@app.middleware("http")
|
316 |
-
async def add_csp_header(request, call_next):
|
317 |
-
response = await call_next(request)
|
318 |
-
response.headers['Content-Security-Policy'] = "frame-ancestors 'self' https://*.azurewebsites.net"
|
319 |
-
return response
|
320 |
-
|
321 |
-
@app.middleware("https")
|
322 |
-
async def add_csp_header(request, call_next):
|
323 |
-
response = await call_next(request)
|
324 |
-
response.headers['Content-Security-Policy'] = "frame-ancestors 'self' https://*.azurewebsites.net"
|
325 |
-
return response
|
326 |
-
|
327 |
-
app.add_middleware(
|
328 |
-
CORSMiddleware,
|
329 |
-
allow_origins=["*"], # Adjust this in production
|
330 |
-
allow_credentials=True,
|
331 |
-
allow_methods=["*"],
|
332 |
-
allow_headers=["*"],
|
333 |
-
)
|
334 |
-
|
335 |
# Define paths for static files
|
336 |
app.mount("/static", StaticFiles(directory="."), name="static")
|
337 |
|
|
|
312 |
# Define the FastAPI app
|
313 |
app = FastAPI()
|
314 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
# Define paths for static files
|
316 |
app.mount("/static", StaticFiles(directory="."), name="static")
|
317 |
|