Not sure what I'm doing wrong here
export default buildConfig({
serverURL: "https://beta.safsonline.com",
admin: {
user: Admins.slug,
},
cors: ["http://localhost:4200", "http://safsbeta1.safsonline.com", "http://safsbeta2.safsonline.com"],
csrf: ["http://localhost:4200", "http://safsbeta1.safsonline.com", "http://safsbeta2.safsonline.com"],
collections: [Admins, Users, Pages, Media, Documents],
typescript: {
outputFile: path.resolve(__dirname, "payload-types.ts"),
},
graphQL: {
schemaOutputFile: path.resolve(__dirname, "generated-schema.graphql"),
},
routes: {
api: '/payload/api',
admin: '/payload/admin',
graphQL: '/payload/graphql',
graphQLPlayground: '/payload/graphql-playground'
}
});
and in server
app.use(express.json());
app.use(
cors({
origin: ["http://localhost:4200", "http://safsbeta1.safsonline.com", "http://safsbeta2.safsonline.com"],
credentials: true,
})
);
You are getting the error on an https URL and only have http URLs listed. Maybe try changing your (what I assume is a production) safsbeta1.safsonline.com URL to https? Also if the 2nd snippet is from the same server that payload uses, I didn't need to set any CORS settings manually on the express instance.