+ 1

How to solve this

Response to preflight request doesn't pass access control check: redirect is not allowed for a preflight request

14th May 2024, 2:24 AM
Audsay
Audsay - avatar
5 Answers
+ 1
CORS preflight issue can easily solved by setting the headers and by handling OPTION requests. Be sure that your PHP server sends the correct CORS headers in response to the preflight OPTIONS request. Also check if the request method is OPTIONS and, if so, send an appropriate response without performing any redirections, no redirects are occurring in response to OPTIONS requests. This is crucial because redirects are not allowed in the preflight check. Check these links: 1. https://www.wpeform.io/blog/handle-cors-preflight-php-wordpress/ 2. https://stackoverflow.com/questions/44479681/cors-php-response-to-preflight-request-doesnt-pass-am-allowing-origin
14th May 2024, 2:39 AM
`ᴴᵗᵗየ
`ᴴᵗᵗየ - avatar
0
I have added the headers to my receive_data controller in website 2. But when I click on the send_data button on my website 1, I still get the same error.
14th May 2024, 4:39 AM
Audsay
Audsay - avatar
0
Do you check your Ajax request
14th May 2024, 6:23 AM
`ᴴᵗᵗየ
`ᴴᵗᵗየ - avatar