ether / etherpad-lite

Etherpad: A modern really-real-time collaborative document editor.
http://docs.etherpad.org/
Apache License 2.0
16.52k stars 2.84k forks source link

typo in nginx reverse proxy config #6402

Closed aaronpk closed 2 months ago

aaronpk commented 4 months ago

In the nginx wiki page here: https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy#hosted-at--with-rewrite-rules-to-allow-padname

There is a typo in the config. I needed the admin rewrite rule to be this instead:

rewrite  ^/admin(.*) /admin$1 break;

Currently the docs say rewrite ^/admin(.*) /admin/$1 break; with an extra slash.

SamTV12345 commented 4 months ago

For me it's the other way round. If I use your setting I'm getting redirected to http://localhost/pad/admin/admin/ . But if I use your setting I'm getting a 404 file not found.

I use this Docker-Compose:

version: '3'
services:
  web:
    image: nginx
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
    ports:
      - "80:80"

and this is the complete nginx conf:

events {

}
http {
server {
    listen 80;
    listen [::]:80;
    location /pad {
        rewrite         /pad/(.*) /$1 break;
        rewrite         ^/pad$ /pad/ permanent;
        proxy_redirect  / /pad/;

        proxy_pass         http://192.168.2.122:9001;
        proxy_buffering    off; # be careful, this line doesn't override any proxy_buffering on set in a conf.d/file.conf
        proxy_set_header   Host $host;
        proxy_pass_header  Server;

        # Note you might want to pass more headers etc too. See above configs.
    }

    location /pad/socket.io {
        rewrite         /pad/socket.io/(.*) /socket.io/$1 break;
        proxy_redirect  / /pad/;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_pass         http://192.168.2.122:9001;
        proxy_buffering    off; # be careful, this line doesn't override any proxy_buffering on set in a conf.d/file.conf
        proxy_set_header   Host $host;
        proxy_pass_header  Server;
    proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        # Note you might want to pass more headers etc too. See above configs.
    }

    location /pad/admin {
        rewrite         /pad/admin/(.*) /admin/$1 break;
        proxy_redirect  / /pad/;
    proxy_set_header   X-Proxy-Path /pad;
        proxy_pass         http://192.168.2.122:9001;

        proxy_buffering    off; # be careful, this line doesn't override any proxy_buffering on set in a conf.d/file.conf
        proxy_set_header   Host $host;
        proxy_pass_header  Server;

        # Note you might want to pass more headers etc too. See above configs.
    }

    location /pad/admin-auth {
        rewrite         /pad/admin-auth/(.*) /admin-auth/$1 break;
        proxy_redirect  / /pad/;
    proxy_set_header   X-Proxy-Path /pad;
        proxy_pass         http://192.168.2.122:9001;

        proxy_buffering    off; # be careful, this line doesn't override any proxy_buffering on set in a conf.d/file.conf
        proxy_set_header   Host $host;
        proxy_pass_header  Server;

        # Note you might want to pass more headers etc too. See above configs.
    }

    location /pad/static {
        rewrite  /pad/static/(.*) /static/$1 break;

        proxy_pass         http://192.168.2.122:9001;
        proxy_buffering    off; # be careful, this line doesn't override any proxy_buffering on set in a conf.d/file.conf
        proxy_set_header   Host $host;
        proxy_pass_header  Server;

        # Note you might want to pass more headers etc too. See above configs.
    }
}
}