payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
25.77k stars 1.64k forks source link

Admin bar not showing in qa env #8538

Closed KBambharoliya closed 1 month ago

KBambharoliya commented 1 month ago

Link to reproduction

No response

Describe the Bug

I have implemented payload-adminbar and it's working fine in my local. but when i deploy changes in qa environment earlier it gives CROS error after adding below changes it's gone but users data getting null for "api/users/me" if i'm login in qa cms . How to resolve this issue.

customHeaders:- pattern: "*/" headers:

To Reproduce

I have implemented payload-adminbar and it's working fine in my local. but when i deploy changes in qa environment earlier it gives CROS error after adding below changes it's gone but users data getting null for "api/users/me" if i'm login in qa cms . How to resolve this issue.

customHeaders:- pattern: "*/" headers:

Payload Version

2.13.0

Adapters and Plugins

No response

paulpopus commented 1 month ago

Hey, when deploying you need to setup CORS and CSRF to point to your deployed server's domain.

Docs: https://payloadcms.com/docs/production/preventing-abuse#cross-origin-resource-sharing-cors

Here is how it's setup in our website template for v2: https://github.com/payloadcms/payload/blob/main/templates/website/src/payload/payload.config.ts#L77

So for github my config would be like

cors: ['https://github.com'],
csrf: ['https://github.com'],

Without / at the end. And ideally behind some kind of logic check and an env variable so that you can have it disabled locally and configurable per environment.

github-actions[bot] commented 1 month ago

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.