salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.26k stars 2.03k forks source link

CORS Error: Missing PATCH Method in Access-Control-Allow-Methods Header #10462

Open michaelG42 opened 2 days ago

michaelG42 commented 2 days ago

Issue

When attempting to update records using the SuiteCRM V8 API, a CORS error occurs because the PATCH method is not included in the Access-Control-Allow-Methods header.

Steps to Reproduce

  1. Make a PATCH request from the browser to the SuiteCRM V8 API to update a record.
  2. Observe the CORS error.

Expected Behavior

The PATCH request should be allowed, and the record should be updated.

Actual Behavior

A CORS error is thrown, and the request is blocked.

File and Code

The issue is in the file: suitecrm/Api/Core/app.php on the following line:

header('Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE');

### Possible Fix

header('Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE, PATCH');

### Steps to Reproduce the Issue

```bash
1. Make a PATCH request from the browser to the SuiteCRM V8 API to update a record.
2. Observe the CORS error.

Context

No response

Version

7.14

What browser are you currently using?

Chrome

Browser Version

No response

Environment Information

php 8.2

Operating System and Version

macOS sonoma 14.2.1