Blocked by CORS policy: No 'Access-Control-Allow-Origin'

Hi. I am getting this error in my code on a site I’m working on. Can anyone tell me if the problem is on the Webflow side or on the server where the custom code is hosted?

Access to XMLHttpRequest at ‘Link’ from origin ‘Link’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

This is the site

Thanks for this. Where or how do I add that to the tweets.php file?

1 Like

Can you elaborate? This is not very clear

Access-Control-Allow-Origin is a CORS (Cross-Origin Resource Sharing) header. The error you get is due to the CORS standard, which sets some restrictions on how JavaScript can perform ajax requests.

When Site A tries to fetch content from Site B, Site B can send an Access-Control-Allow-Origin response header to tell the browser that the content of this page is accessible to certain origins. By default, Site B’s pages are not accessible to any other origin; using the Access-Control-Allow-Origin header opens a door for cross-origin access by specific requesting origins.

For each resource/page that Site B wants to make accessible to Site A, Site B should serve its pages with the response header:

Access-Control-Allow-Origin: http://siteA.com

Hello,

Does anyone have a solution to this? I’m also getting the same problem.
@webdev maybe you have an explanation because I couldn’t understand much from that link you shared. Also @alexaminar where would I post the code you commented?

Thanks for any help,
Will

@WillSayer - You can’t implement a custom header unless you control the resource hosting the asset you wish to load. Some CDNs allow you to specify one. Suppose they don’t, then move the asset to somewhere else. You are stuck with this issue if you can’t move it.

1 Like

Thank you for your explanation! I ended up removing a form which I think was trying to either GET or POST to a webhook, one I removed that I didn’t have the error anymore.