Guides › HTML / PHP sites › Security & hacks

CORS Error in Console: What It Means and Typical Fixes

Browsers block cross-origin requests without proper headers.

Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Security and hacking

A CORS error means your page tried to fetch something from another address and that server did not allow it. The browser blocks it for safety. The fix is made on the server that owns the resource.

1Read the full message2Find who owns the resource3Add the header4Handle preflight5Watch credentials6Fonts from a CDN7RetestFixed? Test the site. If not, get help.
The steps in order. Work down the list and stop when the problem is solved.

Step 1: Read the full message

Illustration for Step 1: Read the full message

In the console it says blocked by CORS policy: No 'Access-Control-Allow-Origin' header. It names the page and the address being requested.

Step 2: Find who owns the resource

Illustration for Step 2: Find who owns the resource

If it is your own API, you can change it. If it is a third party, you may need a different method or their support.

Step 3: Add the header

Illustration for Step 3: Add the header

On your server send Access-Control-Allow-Origin: https://yourdomain.com. In Apache: Header set Access-Control-Allow-Origin "https://yourdomain.com".

Step 4: Handle preflight

Illustration for Step 4: Handle preflight

For custom headers or methods like PUT, the browser sends an OPTIONS request first. The server must answer it with allowed methods and headers.

Step 5: Watch credentials

Illustration for Step 5: Watch credentials

If you send cookies, the origin must be exact, not *, and Access-Control-Allow-Credentials: true is required.

Step 6: Fonts from a CDN

Illustration for Step 6: Fonts from a CDN

Fonts loaded from another domain also need the header on the font files.

Step 7: Retest

Illustration for Step 7: Retest

Hard refresh, and check the Network tab for the header in the response.

Still stuck?

If these steps do not solve it, we fix it for you for a flat $99. Full refund if we do not solve it within 7 days.

Related guides

Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.

Last updated 2026-11-22.