Spaces:
Running
Running
Use generic regex for CORS instead of hardcoded deployment URLs
Browse filesCovers both *.hf.space and *.code.run without embedding server-specific
hostnames. Works for HF Spaces and Northflank deployments alike.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- server/app.py +1 -3
server/app.py
CHANGED
|
@@ -406,10 +406,8 @@ app.add_middleware(
|
|
| 406 |
"http://localhost:7860",
|
| 407 |
"http://localhost:3000",
|
| 408 |
"http://localhost:8000",
|
| 409 |
-
"https://web--jupyter-pytorch--9y6g97v7czb9.code.run",
|
| 410 |
-
"https://api--jupyter-pytorch--9y6g97v7czb9.code.run",
|
| 411 |
],
|
| 412 |
-
allow_origin_regex=r"https://.*\.hf\.space|
|
| 413 |
allow_credentials=True,
|
| 414 |
allow_methods=["*"],
|
| 415 |
allow_headers=["*"],
|
|
|
|
| 406 |
"http://localhost:7860",
|
| 407 |
"http://localhost:3000",
|
| 408 |
"http://localhost:8000",
|
|
|
|
|
|
|
| 409 |
],
|
| 410 |
+
allow_origin_regex=r"https://.*\.(hf\.space|code\.run)",
|
| 411 |
allow_credentials=True,
|
| 412 |
allow_methods=["*"],
|
| 413 |
allow_headers=["*"],
|