Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CORS related docs #10332

Open
Danil0v3s opened this issue Jan 3, 2025 · 2 comments · Fixed by #10333 · May be fixed by #10597
Open

Improve CORS related docs #10332

Danil0v3s opened this issue Jan 3, 2025 · 2 comments · Fixed by #10333 · May be fixed by #10597
Labels
documentation Improvements or additions to documentation status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@Danil0v3s
Copy link
Contributor

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.

@Danil0v3s Danil0v3s added the documentation Improvements or additions to documentation label Jan 3, 2025
@Danil0v3s
Copy link
Contributor Author

@jacobsfletch should this really be closed? It might have been automated from merging the PR but I think there's still an outstanding action to document CORS for custom endpoints. What do you think?

@jacobsfletch jacobsfletch reopened this Jan 6, 2025
@github-actions github-actions bot added the status: needs-triage Possible bug which hasn't been reproduced yet label Jan 6, 2025
Copy link
Contributor

github-actions bot commented Jan 7, 2025

🚀 This is included in version v3.15.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
2 participants