CORS issue on Trustpilot widget

[ad_1]

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]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer