Php backend interfaces cannot cross domains

has been added to the php interface file:

header("Access-Control-Allow-Origin:*");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");

however, the front end still reports an error when calling the interface to request data:

Failed to load http://aaa.com/version?test=1: Redirect from "http://aaa.com/version?test=1" to "http://bbb.com" has been blocked by CORS policy: No "Access-Control-Allow-Origin" header is present on the requested resource. Origin "http://ccc.com" is therefore not allowed access.

clipboard.png

clipboard.png

Apr.03,2021

you can use callback to solve cross-domain problems at the front end


the Access-Control-Allow-Origin you set depends on whether your Response Headers has
some frames will override your settings

clipboard.png

also set
Access-Control-Allow-Method: GET POST OPTIONS PUT


you didn't even add header, * there is a space missing in front of you

Menu