Skip to content

Commit 072e926

Browse files
committed
feat: added cors & csrf in payload-config
1 parent 59cfaac commit 072e926

2 files changed

Lines changed: 39 additions & 28 deletions

File tree

public/sitemap.xml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
3-
<url><loc>http://localhost:3000</loc><lastmod>2026-05-12T15:37:25.842Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority><xhtml:link rel="alternate" hreflang="en" href="http://localhost:3000/en"/><xhtml:link rel="alternate" hreflang="de" href="http://localhost:3000/de"/></url>
4-
<url><loc>http://localhost:3000/en</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>1</priority></url>
5-
<url><loc>http://localhost:3000/en/about-us</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
6-
<url><loc>http://localhost:3000/en/actions</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
7-
<url><loc>http://localhost:3000/en/blog</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
8-
<url><loc>http://localhost:3000/en/community-edition</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
9-
<url><loc>http://localhost:3000/en/contact</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
10-
<url><loc>http://localhost:3000/en/enterprise-edition</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
11-
<url><loc>http://localhost:3000/en/features</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
12-
<url><loc>http://localhost:3000/en/jobs</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
13-
<url><loc>http://localhost:3000/en/legal-notice</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
14-
<url><loc>http://localhost:3000/en/privacy</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
15-
<url><loc>http://localhost:3000/en/subscription</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
16-
<url><loc>http://localhost:3000/en/terms</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
17-
<url><loc>http://localhost:3000/de</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>1</priority></url>
18-
<url><loc>http://localhost:3000/de/about-us</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
19-
<url><loc>http://localhost:3000/de/actions</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
20-
<url><loc>http://localhost:3000/de/blog</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
21-
<url><loc>http://localhost:3000/de/community-edition</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
22-
<url><loc>http://localhost:3000/de/contact</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
23-
<url><loc>http://localhost:3000/de/enterprise-edition</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
24-
<url><loc>http://localhost:3000/de/features</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
25-
<url><loc>http://localhost:3000/de/jobs</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
26-
<url><loc>http://localhost:3000/de/legal-notice</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
27-
<url><loc>http://localhost:3000/de/privacy</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
28-
<url><loc>http://localhost:3000/de/subscription</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
29-
<url><loc>http://localhost:3000/de/terms</loc><lastmod>2026-05-12T15:37:25.843Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
3+
<url><loc>http://localhost:3000</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority><xhtml:link rel="alternate" hreflang="en" href="http://localhost:3000/en"/><xhtml:link rel="alternate" hreflang="de" href="http://localhost:3000/de"/></url>
4+
<url><loc>http://localhost:3000/en</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>1</priority></url>
5+
<url><loc>http://localhost:3000/en/about-us</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
6+
<url><loc>http://localhost:3000/en/actions</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
7+
<url><loc>http://localhost:3000/en/blog</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
8+
<url><loc>http://localhost:3000/en/community-edition</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
9+
<url><loc>http://localhost:3000/en/contact</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
10+
<url><loc>http://localhost:3000/en/enterprise-edition</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
11+
<url><loc>http://localhost:3000/en/features</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
12+
<url><loc>http://localhost:3000/en/jobs</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
13+
<url><loc>http://localhost:3000/en/legal-notice</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
14+
<url><loc>http://localhost:3000/en/privacy</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
15+
<url><loc>http://localhost:3000/en/subscription</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
16+
<url><loc>http://localhost:3000/en/terms</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
17+
<url><loc>http://localhost:3000/de</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>1</priority></url>
18+
<url><loc>http://localhost:3000/de/about-us</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
19+
<url><loc>http://localhost:3000/de/actions</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
20+
<url><loc>http://localhost:3000/de/blog</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
21+
<url><loc>http://localhost:3000/de/community-edition</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
22+
<url><loc>http://localhost:3000/de/contact</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
23+
<url><loc>http://localhost:3000/de/enterprise-edition</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
24+
<url><loc>http://localhost:3000/de/features</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
25+
<url><loc>http://localhost:3000/de/jobs</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
26+
<url><loc>http://localhost:3000/de/legal-notice</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
27+
<url><loc>http://localhost:3000/de/privacy</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
28+
<url><loc>http://localhost:3000/de/subscription</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
29+
<url><loc>http://localhost:3000/de/terms</loc><lastmod>2026-05-13T05:17:48.888Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
3030
</urlset>

src/payload.config.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,25 @@ const dirname = path.dirname(filename)
2626
const smtpHost = process.env.SMTP_HOST
2727
const isBuildPhase = process.env.NEXT_PHASE === "phase-production-build" || process.env.npm_lifecycle_event === "build"
2828
const isDevelopment = process.env.NODE_ENV === "development"
29+
const appURL = (process.env.NEXT_PUBLIC_APP_URL?.trim() || (isDevelopment ? 'http://localhost:3000' : 'https://codezero.build')).replace(/\/$/, '')
30+
const allowedOrigins = Array.from(
31+
new Set([
32+
appURL,
33+
'http://localhost:3000',
34+
'https://localhost:3000',
35+
'https://codezero.build',
36+
]),
37+
)
2938
const shouldSkipEmailVerify =
3039
isDevelopment ||
3140
isBuildPhase ||
3241
process.env.PAYLOAD_SKIP_EMAIL_VERIFY === "true" ||
3342
!smtpHost
3443

3544
export default buildConfig({
36-
serverURL: process.env.NEXT_PUBLIC_APP_URL,
45+
serverURL: appURL,
46+
cors: allowedOrigins,
47+
csrf: allowedOrigins,
3748
admin: {
3849
user: Users.slug,
3950
importMap: {

0 commit comments

Comments
 (0)