Skip to content

Commit cdeb1ee

Browse files
committed
added cors again
1 parent 9d1d209 commit cdeb1ee

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

server/main.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
origins = [
1212
"https://ricardogarcia.uk",
1313
"https://www.ricardogarcia.uk",
14-
"https://ricardogarcia.uk/weather",
15-
"https://ricardogarcia.uk/pcs_contracts",
16-
"https://217.160.0.207",
1714
"https://rigsnv-ejfqade8hydkh3c8.uksouth-01.azurewebsites.net",
1815
"http://localhost:5173",
1916
"http://127.0.0.1/5173",
@@ -27,21 +24,6 @@
2724
allow_headers=["*"],
2825
)
2926

30-
@app.middleware("http")
31-
async def referer_and_path_middleware(request: Request, call_next):
32-
# Check the Referer header
33-
referer = request.headers.get("referer")
34-
allowed_referers = origins
35-
36-
# Check the request path
37-
allowed_paths = ["/weather", "/pcs_contracts"]
38-
39-
if referer and any(referer.startswith(allowed) for allowed in allowed_referers) and request.url.path in allowed_paths:
40-
response = await call_next(request)
41-
return response
42-
43-
return JSONResponse(status_code=403, content={"detail": "Forbidden: Invalid referer or path"})
44-
4527
@app.get("/")
4628
async def root():
4729
return{"message": "Hello World of Fast APIs on Azure!"}
@@ -77,5 +59,3 @@ def get_contracts():
7759
def update_contracts(date_from=None, notice_type=3, output_type=0):
7860
client = PCSClient()
7961
return client.get_pcs_contracts(date_from=date_from, notice_type=notice_type, output_type=output_type)
80-
81-
#test, this should trigger a build

0 commit comments

Comments
 (0)