-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CORS OPTIONS preflight 404 if not routed #1242
Comments
In order to make it work, you just have to have a route at /api/v1/login .. i.e. when you have defined a GET or POST route for it, the OPTIONS preflight is collecting the available http methods that are available, returning a |
Thanks for the reply. I had it. What you say is right, but if I specify the attribute [ajax] Ex: POST /api/v1/login [ajax] = Api_Auth_Controller->login // this makes the OPTIONS fail While, as you said: |
Well then it's probably a bug with the ajax flag, which should be ignored in such a case |
I Second to just use the POST /api/v1/login = Api_Auth_Controller->login method. I also do this in my middle-ware router (your pre-flight?) to handle any custom headers
|
In fact I will remove the [ajax] specification. Thanks to all. |
fixed. |
I'm building an API rest app. I was having issues with CORS preflight fail.
I am not using the $f3->map(). I am mapping every routes in a custom routes.ini
Reading the docs I thought I could not care about OPTIONS, but if I do not route the OPTIONS, it always triggers a 404.
I must add a [OPTIONS /api/... = Ctr->preflight] to handle it, where the preflight method just contains an exit function. Then f3 does the rest of the job
The text was updated successfully, but these errors were encountered: