Search code examples
laravelheaderxmlhttprequestcorswildcard

Cors policy Issue Laravel youtube apache


Access to XMLHttpRequest at 'https://googleads.g.doubleclick.net/pagead/id' from origin 'https://www.youtube.com' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

I am using laravel 5.1 when i use youtube embedded iframe i receive this error. i am unable to find where is access control allow origin is passing a * as wildcard. can anybody help please.


Solution

  • Try adding below lines of code in your .htaccess file.

    <IfModule mod_headers.c>
        Header add Access-Control-Allow-Origin "*"
    </IfModule>