Skip to content
Advertisement

Tag: cors

CORS not working php

I am trying to post form data from www.siteone.com to www.sitetwo.com via CORS. My ajax code is this: and the file cors.php in www.sitetwo.com is as follows: But still Access-control-Allow-Origin error is thrown. The error thrown is this: I came to know that, using CORS by just allowing the remote website via headers, we can use cross-domain request. But when

Cross-Origin Request Headers(CORS) with PHP headers

I have a simple PHP script that I am attempting a cross-domain CORS request: Yet I still get the error: Request header field X-Requested-With is not allowed by Access-Control-Allow-Headers Anything I’m missing? Answer Access-Control-Allow-Headers does not allow * as accepted value, see the Mozilla Documentation here. Instead of the asterisk, you should send the accepted headers (first X-Requested-With as the

Advertisement