Skip to content

Commit eaaab34

Browse files
committed
Add proxy_headers to admin routes
1 parent caf404c commit eaaab34

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

nginx/templates/servers.conf.template

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ server {
33
server_name ${NGINX_HOST};
44

55
location / {
6-
proxy_pass http://payload:3000;
7-
86
add_header X-Cache $upstream_cache_status;
97

108
proxy_http_version 1.1;
119
proxy_set_header Upgrade $http_upgrade;
1210
proxy_set_header Connection "upgrade";
1311
proxy_set_header Host $host;
14-
proxy_set_header X-Forwarded-For $host;
12+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
1513
proxy_set_header X-Forwarded-Proto $scheme;
1614
proxy_set_header X-Forwarded-Host $host;
1715

@@ -24,14 +22,32 @@ server {
2422
proxy_cache_valid any 1m;
2523
proxy_cache_revalidate on;
2624
proxy_cache_use_stale error timeout updating;
25+
26+
proxy_pass http://payload:3000;
2727
}
2828

2929
# Doing this in both ways to avoid a redirect loop
3030
location /admin {
31+
proxy_http_version 1.1;
32+
proxy_set_header Upgrade $http_upgrade;
33+
proxy_set_header Connection "upgrade";
34+
proxy_set_header Host $host;
35+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
36+
proxy_set_header X-Forwarded-Proto $scheme;
37+
proxy_set_header X-Forwarded-Host $host;
38+
3139
proxy_pass http://payload:3000/admin;
3240
}
3341

3442
location /admin/ {
43+
proxy_http_version 1.1;
44+
proxy_set_header Upgrade $http_upgrade;
45+
proxy_set_header Connection "upgrade";
46+
proxy_set_header Host $host;
47+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
48+
proxy_set_header X-Forwarded-Proto $scheme;
49+
proxy_set_header X-Forwarded-Host $host;
50+
3551
proxy_pass http://payload:3000/admin/;
3652
}
3753
}

src/payload.config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import { es } from 'payload/i18n/es'
2929
const filename = fileURLToPath(import.meta.url)
3030
const dirname = path.dirname(filename)
3131

32-
console.log(process.env.EMAIL_USER, EMAIL_PASSWORD)
33-
3432
export default buildConfig({
3533
admin: {
3634
user: Users.slug,

0 commit comments

Comments
 (0)