Skip to content

graycoreio/magento2-cors

This branch is up to date with master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

80fbc64 · Oct 10, 2024
Feb 7, 2024
Jun 11, 2022
Jun 11, 2022
Oct 19, 2023
Jun 4, 2021
Feb 7, 2024
Oct 19, 2023
Oct 19, 2023
Oct 10, 2024
Nov 1, 2023
Jun 26, 2022
Oct 10, 2024
Aug 10, 2020
Oct 10, 2024
May 13, 2020
May 13, 2020
May 13, 2020
Jun 26, 2022
Oct 14, 2022
Oct 14, 2022
Oct 14, 2022
Jul 19, 2019
Feb 7, 2024

Repository files navigation

Magento 2 CORS

Packagist Downloads Packagist Version Packagist License Unit Test Integration Test Installation Test

Magento Version Support

Magento v2.3 Supported Magento v2.4 Supported

Ever try to work with the Magento GraphQL API or REST API from your browser and see the following?

Access to XMLHttpRequest at 'https://my.magento.app' from origin 'http://my.webapp.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

This package allows you to securely add the necessary CORS headers to the Magento 2 GraphQL or REST APIs with ease.

Purpose

When building a headless application for Magento, or working with a client that respects the CORS protocol, you will need CORS headers on your backend resource.

This package will add configurable CORS Resource headers to the Magento 2 GraphQL or REST APIs, allowing you to access the GraphQL or REST APIs from your browser.

Getting Started

This module is intended to be installed with composer. From the root of your Magento 2 project:

  1. Download the package
composer require graycore/magento2-cors
  1. Configure the package
  2. Enable the package
./bin/magento module:enable Graycore_Cors

Features

Helpful Links

Upgrading