Cors issue with Railway's edge file server intercepting OPTIONS requests before they reach FastAPI.
snowboltech
HOBBYOP
3 months ago
Evidence:
- Service URL: `automated-betting-backend-production.up.railway.app`
- Error: `fileserver.(*FileServer).notFound (staticfiles.go:721): HTTP 404`
- Request method: `OPTIONS`
- Request URI: `/api/auth/me` (and all `/api/*` routes)
- Origin: `https://automated-betting-system.netlify.app`
Service Configuration:
- Service Type: Web Service
- Builder: Railpack
- Root Directory: `backend`
- Start Command: `uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8000}`
What We've Tried**:
1. Configured CORS middleware correctly in FastAPI
2. Added explicit OPTIONS route handlers
3. Added middleware to handle OPTIONS requests
4. Set `CORS_ORIGINS` environment variable
5. Added `.railwayignore` to prevent static file serving
6. Verified service type is "Web Service" (not "Static Site")
Request:
Please configure Railway's edge server to pass OPTIONS requests (and all `/api/*` routes) to our FastAPI application instead of intercepting them with the file server.
Impact:
- Frontend cannot connect to backend
- All API calls fail with CORS errors
- Production application is non-functional
1 Replies
Railway
BOT
3 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
Status changed to Solved snowboltech • 3 months ago