Improve CORS related docs #10332
Labels
documentation
Improvements or additions to documentation
status: needs-triage
Possible bug which hasn't been reproduced yet
Documentation Issue
Me and my team are implementing an e-commerce product with two separate instances between back-end and front-end, CORS started to become an issue with v2 and now with v3 I couldn't for the life of me figure out what was going wrong, the docs briefly mention at Config Options you have the possibility to enable CORS and CSRF but these doesn't seem to work out of the box with custom Endpoints. Also https://payloadcms.com/docs/configuration/overview#cors seems to be broken since it doesn't lead anywhere on the site.
After many hours of digging I decided to checkout the repo and search everywhere for usages of CORS and came across
headersWithCors
at examples/multi-tenant/src/collections/Users/endpoints/externalUsersLogin.ts and finally these seem to have fixed the issue once and for all.Additional Details
If custom Endpoints are not part of the default cors handling by default that should be explicit on the related section of the docs and the alternate solution could be briefly mentioned with a link to a concrete example. I reckon not everyone is going to hit this issue but it's frustrating to not find this piece of info in an otherwise pristine documentation.
The text was updated successfully, but these errors were encountered: