1 Commits
Author SHA1 Message Date
Linus Gasser 565e8c0f97 Cleanup of unused vars and treafike forwarding
CryptPad never reads CPAD_HTTP2_DISABLE or CPAD_TRUST_PROXY, so remove
them (and the misleading comment) from compose.yml.

nginx used to overwrite X-Forwarded-Proto with its own $scheme (http) and
X-Real-IP with Traefik's container IP. Pass through the values Traefik
sets, falling back to nginx's own when absent, and add X-Forwarded-Host.

Bump NGINX_CONF_VERSION to v4.
2026-12-01 09:53:39 +00:00
3 changed files with 26 additions and 9 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
export CONFIG_VERSION=v3
export CONFIG_JS_VERSION=v2
export NGINX_CONF_VERSION=v3
export NGINX_CONF_VERSION=v4
export INFRA_JS_VERSION=v1
export SSO_ENTRYPOINT_VERSION=v8
export SSO_JS_VERSION=v3
-4
View File
@@ -11,10 +11,6 @@ services:
- CRYPTPAD_ADMIN_KEYS
- "CPAD_MAIN_DOMAIN=https://${DOMAIN}"
- "CPAD_SANDBOX_DOMAIN=https://${SANDBOX_DOMAIN}"
# Traefik can't use HTTP2 to communicate with cryptpad_websocket
# A workaroung is disabling HTTP2 in Nginx
- "CPAD_HTTP2_DISABLE=true"
- "CPAD_TRUST_PROXY=1"
- "CPAD_CONF=/cryptpad/config/config.js"
- "RESTRICT_GUEST_ACCESS=${RESTRICT_GUEST_ACCESS:-false}"
volumes:
+25 -4
View File
@@ -1,3 +1,22 @@
# Traefik terminates TLS and sets X-Forwarded-* / X-Real-IP. Pass its values
# through to CryptPad instead of overwriting them with nginx's own view
# (which would be plain http and Traefik's container IP). Fall back to
# nginx's values when the headers are absent.
map $http_x_forwarded_proto $forwarded_proto {
default $http_x_forwarded_proto;
"" $scheme;
}
map $http_x_forwarded_host $forwarded_host {
default $http_x_forwarded_host;
"" $host;
}
map $http_x_real_ip $forwarded_real_ip {
default $http_x_real_ip;
"" $remote_addr;
}
server {
listen 8083;
server_name localhost;
@@ -17,9 +36,10 @@ server {
proxy_pass $cryptpad_upstream;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-IP $forwarded_real_ip;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_set_header X-Forwarded-Host $forwarded_host;
client_max_body_size 150m;
@@ -33,9 +53,10 @@ server {
proxy_pass $cryptpad_upstream;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-IP $forwarded_real_ip;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_set_header X-Forwarded-Host $forwarded_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;