4 months ago
I’m encountering an issue where OPTIONS preflight requests are being rejected by your proxy layer before they reach my FastAPI application.
Here’s what I’m seeing:
Status: 405 Method Not Allowed
Allow: GET, HEAD
Server: Caddy
My application correctly handles OPTIONS requests and sets the required Access-Control-Allow-* headers using FastAPI’s CORSMiddleware, but these requests are not reaching my app. The response comes directly from your edge network or reverse proxy (Caddy) instead.
Could you please advise on how to configure Railway to:
Allow OPTIONS requests to pass through to the backend (especially for the root / path)?
Or configure the proxy to return valid CORS headers itself for OPTIONS preflight requests.
This is blocking CORS preflight success for cross-origin requests from my frontend. My backend is deployed with Uvicorn behind your default proxy setup, no Caddyfile is used on my side.
Looking forward to your advice on resolving this.
Noodle
0 Replies
4 months ago
scintillating-fulfillment
4 months ago
Hello,
There is no scenario where we would send a 405, nor do we use Caddy as a Proxy.
Your frontend likely uses Caddy to serve the static files, and your frontend is likely trying to make a request to its own domain, instead of the backend's domain.
4 months ago
Interesting, there is no caddy file in my front end, and the requests are properly configured to the back end. Cannot figure out why one end is not talking to the other and the 405 is being noted in the server log
4 months ago
But thanks Brody!
4 months ago
You may not have Caddy, but that's what Railpack uses to serve your static files.
Have you verified via the networking tab that the 405 requests are going to the domain of the backend?
4 months ago
Please excuse me, I'm not a dev or a coder, I'm just a hobbyist trying to design my app using AI. I know a little though. That's why I came onto discord, to see if I could get some guidance. I know where the networking tab is, but not sure which part tells me what you're referring to. Could you please tell me where to look?
4 months ago
This is from the console log from my UI, does that help?
3 months ago
while i cannot teach you how to use the developer tools, i can provide you with this link -