This commit is contained in:
zino
2025-09-23 10:09:42 +02:00
parent 313e3f79a6
commit 32496343ba

View File

@@ -15,9 +15,11 @@ server {
auth_basic "Protected"; auth_basic "Protected";
auth_basic_user_file /usr/share/nginx/html/etherpad.zinomedia.de/.htpasswd; auth_basic_user_file /usr/share/nginx/html/etherpad.zinomedia.de/.htpasswd;
# Docker DNS
resolver 127.0.0.11 valid=30s ipv6=off; resolver 127.0.0.11 valid=30s ipv6=off;
location ~ ^/(locales/|locales\.json|admin/|static/|pluginfw/|javascripts/|socket\.io/|ep/|minified/|api/|ro/|error/|jserror|favicon\.ico|robots\.txt|indexBootstrap-.*\.js)$ { # 1) Pass-through (original, no /p/ prefix)
location ~ ^/(locales/|locales\.json|admin/|static/|pluginfw/|javascripts/|socket\.io/|ep/|minified/|api/|ro/|error/|jserror|redirect|favicon\.ico|robots\.txt|indexBootstrap-.*\.js)$ {
set $upstream "http://etherpad:9001"; set $upstream "http://etherpad:9001";
proxy_pass $upstream; proxy_pass $upstream;
proxy_buffering off; proxy_buffering off;
@@ -31,10 +33,12 @@ server {
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;
} }
location ~ ^/p/(locales/|locales\.json|admin/|static/|pluginfw/|javascripts/|socket\.io/|ep/|minified/|api/|ro/|error/|jserror|favicon\.ico|robots\.txt|indexBootstrap-.*\.js)$ { # 2) Strip /p/ prefix from those same paths (INTERNAL rewrite, no 301)
return 301 /$1$is_args$args; # /p/static/... -> /static/... location ~ ^/p/(locales/|locales\.json|admin/|static/|pluginfw/|javascripts/|socket\.io/|ep/|minified/|api/|ro/|error/|jserror|redirect|favicon\.ico|robots\.txt|indexBootstrap-.*\.js) {
rewrite ^/p/(.*)$ /$1 last;
} }
# 3) Root -> Etherpad UI
location = / { location = / {
set $upstream "http://etherpad:9001"; set $upstream "http://etherpad:9001";
proxy_pass $upstream; proxy_pass $upstream;
@@ -49,7 +53,8 @@ server {
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;
} }
location ^~ /p/ { # 4) All pad URLs under /p/ — just proxy (NO ^~ so regex above can win)
location /p/ {
set $upstream "http://etherpad:9001"; set $upstream "http://etherpad:9001";
proxy_pass $upstream; proxy_pass $upstream;
proxy_buffering off; proxy_buffering off;
@@ -63,6 +68,7 @@ server {
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;
} }
# 5) Friendly URLs for anything else: /foo -> /p/foo (single 301)
location / { location / {
return 301 /p$uri$is_args$args; return 301 /p$uri$is_args$args;
} }