I have a post request that is using the cloudflare proxy to make a request to a fastapi endpoint. When the proxy sends the request for some reason it is using a method called "options" and it is causing a 405 method not allowed error. I have the API Call setup as a post request in toddle.
Great energy @Funktionalized! Your continuous contribution to the toddle Community just made you advance to Community Level 3!
Erik Beuschau
2 months ago
Oct 8, 2024, 3:03 PM
The OPTIONS method is usually used for cross origin requests (CORS). So since your app is on a different origin (domain) than the back-end, it will first send an OPTIONS request to verify that it's allowed to perform that operation. In your case, it seems your endpoint is not open for CORS. Perhaps you could try enabling the proxy checkbox at the bottom of the API dialog to see if that helps? 🤞
There are some security issues related to that, so the browser will often make what is called a pre-flight request to check if the server allows these kinds of requests.
Pre-flight requests are an OPTION request (and one of the only times OPTION requests are used)
When you turn the proxy on the request goes through our gateway first, and you dont have to do the preflight request.
Lucas G
2 months ago
Oct 8, 2024, 10:04 PM
Everyone loves dealing with CORS!
Andreas Møller
2 months ago
Oct 8, 2024, 10:27 PM
That was the original reason for the proxy. Auth was just kind of an obvious next step