Spaces:
Running
Running
axeronis commited on
Commit ·
031be0c
1
Parent(s): dd360b8
fix(api): add trailing slash to products list and enable ProxyHeadersMiddleware to prevent HTTP redirects
Browse files- backend/app/main.py +4 -0
- frontend/lib/api.ts +1 -1
backend/app/main.py
CHANGED
|
@@ -139,6 +139,10 @@ async def global_exception_handler(request: Request, exc: Exception):
|
|
| 139 |
}
|
| 140 |
)
|
| 141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
# Log CORS settings
|
| 143 |
allowed_origins = settings.get_allowed_origins()
|
| 144 |
logger.info(f"CORS allowed origins: {allowed_origins}")
|
|
|
|
| 139 |
}
|
| 140 |
)
|
| 141 |
|
| 142 |
+
# Trust Proxy Headers (Railway/Vercel) - Fixes HTTPS redirects and Mixed Content
|
| 143 |
+
from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware
|
| 144 |
+
app.add_middleware(ProxyHeadersMiddleware, trusted_hosts="*")
|
| 145 |
+
|
| 146 |
# Log CORS settings
|
| 147 |
allowed_origins = settings.get_allowed_origins()
|
| 148 |
logger.info(f"CORS allowed origins: {allowed_origins}")
|
frontend/lib/api.ts
CHANGED
|
@@ -423,7 +423,7 @@ export const productsApi = {
|
|
| 423 |
max_price?: number
|
| 424 |
limit?: number
|
| 425 |
}) => {
|
| 426 |
-
const response = await api.get('/api/v1/products', { params })
|
| 427 |
return response.data
|
| 428 |
},
|
| 429 |
|
|
|
|
| 423 |
max_price?: number
|
| 424 |
limit?: number
|
| 425 |
}) => {
|
| 426 |
+
const response = await api.get('/api/v1/products/', { params })
|
| 427 |
return response.data
|
| 428 |
},
|
| 429 |
|