I’m having an issue implementing two simple widgets (G2 and Trustpilot) on my wordpress site which is hosted on Azure.
Initially, the error I got was:
‘ The response to the CORS request is missing the required Access-Control-Allow-Origin header.’
So I added the below code to my functions.php:
function add_cors_http_header() {
header(“Access-Control-Allow-Origin: *”);
}
add_action(‘init’,’add_cors_http_header’);
This didn’t solve the issue, so I went into my Azure Portal > App Service > CORS and added a “\*” into ‘Allowed origins’.
Now, the error message says:
>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at [https://www.g2.com/products/gigged-ai/rating\_schema.json]). (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 503.
Has anyone come across this before and know how to fix it?
[ad_2]