The whole application is built with
String response = await HttpRequest.getString(url);
XMLHttpRequest cannot load http://my-wordpress/wp-json/wp/v2/pages.
The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:8080, *', but only one is allowed. Origin 'http://localhost:8080' is therefore not allowed access.
I could fix it by commenting out
In the folder
wp-includes there is a file called
On line 376 upwards you see something like this:
header( 'Access-Control-Allow-Origin: ' . esc_url_raw( $origin ) ); header( 'Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE' ); header( 'Access-Control-Allow-Credentials: true' );
This seems to allow the host of the request to access the API. But since I'm already adding
* as Origin, this will fail. So I just commented that code block out and everything works fine now.