Skip to main content

CORS issues

If you are experiencing connection issues when trying to access your Medusa backend from a storefront or the admin dashboard, it is most likely due to Cross-Origin Resource Sharing (CORS) issues.

You might see a log in your browser console, that looks like this:

CORS error log

In your medusa-config.jsCopy to Clipboard , you should ensure that you've configured your CORS settings correctly. By default, the Medusa starter runs on port 9000Copy to Clipboard, Medusa Admin runs on port 7000Copy to Clipboard, and the storefront starters run on port 8000Copy to Clipboard.

The default configuration uses the following CORS settings:

medusa-config.js
// CORS when consuming Medusa from admin
const ADMIN_CORS = process.env.ADMIN_CORS ||
"http://localhost:7000,http://localhost:7001"

// CORS to avoid issues when consuming Medusa from a client
const STORE_CORS =
process.env.STORE_CORS || "http://localhost:8000"
Report Incorrect CodeCopy to Clipboard

If you wish to run your storefront or Medusa admin on other ports, you should update the above settings accordingly.


See Also

Was this page helpful?