+ 1
How to solve this
Response to preflight request doesn't pass access control check: redirect is not allowed for a preflight request
5 Respuestas
+ 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
+ 1
The error "Response to preflight request doesn't pass access control check: redirect is not allowed for a preflight request" typically occurs when making an AJAX request to a different origin (domain, protocol, or port) than the current page.
To solve this issue, you need to configure the server to handle CORS (Cross-Origin Resource Sharing) requests. Here are some solutions:
1. *Server-side solution:*
- Configure the server to include the necessary CORS headers in the response. For example:
- Access-Control-Allow-Origin: *
- Access-Control-Allow-Methods: GET, POST, PUT, DELETE
- Access-Control-Allow-Headers: Content-Type
2. *Client-side solution (using JavaScript):*
- Use the `jsonp` data type in jQuery AJAX requests (if possible).
- Use the `crossDomain: true` option in jQuery AJAX requests.
3. *Proxy solution:*
- Set up a proxy server to handle the request and forward it to the original server.
4. *Browser extension solution:*
- Install a browser extension like
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.
0
Do you check your Ajax request
0
cors Unblock or Allow-Control-Allow-Origin to bypass CORS restrictions.
Note: The specific solution depends on your server-side technology (e.g., Node.js, Apache, Nginx) and client-side framework (e.g., jQuery, React).
If you provide more details about your setup and technology stack, I can offer a more tailored solution.