Skip to content

CORS raising error (correctly), but API POST succeeding #361

@drewbelmont

Description

@drewbelmont

I must be missing a basic step. I'm using allow_origin to restrict requests to my API, e.g.:

'allow_origin'=>'https://x.com',

When I call the API (e.g., from https://example.com), I see an error in the developer console:

Failed to load https://.../api/testpost: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://example.com' is therefore not allowed access.

But the data is inserted into the database (this is a POST) and I get the new id back in the response.

Am I supposed to handle a CORS failure myself, and make sure to terminate the request?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions