Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
gary-boon
commited on
Commit
·
3c5bd74
1
Parent(s):
96a6300
Add CORS support for Vercel production domain
Browse files- Allow WebSocket and API connections from visualisable-ai.vercel.app
- Support all Vercel preview deployments with wildcard
- backend/model_service.py +8 -2
backend/model_service.py
CHANGED
|
@@ -23,10 +23,16 @@ logger = logging.getLogger(__name__)
|
|
| 23 |
|
| 24 |
app = FastAPI(title="Visualisable.ai Model Service", version="0.1.0")
|
| 25 |
|
| 26 |
-
# CORS configuration for local development
|
| 27 |
app.add_middleware(
|
| 28 |
CORSMiddleware,
|
| 29 |
-
allow_origins=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
allow_credentials=True,
|
| 31 |
allow_methods=["*"],
|
| 32 |
allow_headers=["*"],
|
|
|
|
| 23 |
|
| 24 |
app = FastAPI(title="Visualisable.ai Model Service", version="0.1.0")
|
| 25 |
|
| 26 |
+
# CORS configuration for local development and production
|
| 27 |
app.add_middleware(
|
| 28 |
CORSMiddleware,
|
| 29 |
+
allow_origins=[
|
| 30 |
+
"http://localhost:3000",
|
| 31 |
+
"http://localhost:3001",
|
| 32 |
+
"http://localhost:3002",
|
| 33 |
+
"https://visualisable-ai.vercel.app",
|
| 34 |
+
"https://*.vercel.app"
|
| 35 |
+
],
|
| 36 |
allow_credentials=True,
|
| 37 |
allow_methods=["*"],
|
| 38 |
allow_headers=["*"],
|