Set base URL for Etherpad-lite - w/o rewrite voodoo?

545 views
Skip to first unread message

Tim Colson

unread,
Mar 9, 2012, 6:17:37 PM3/9/12
to etherpad-open-...@googlegroups.com
Hi folks -- 

I want to front Etherpad-Lite on a linux machine at http://box.somewhere.com:9001 with http://box.somewhere.com/note -- i.e. port 80 and a different sub-directory, not a virtual host, no https. 

After much pain with Apache, I decided to try my hand at NGINX (since the config looked simpler). 
  location /pad {        
      rewrite                /pad/(.*) /$1 break;
      proxy_pass             http://localhost:9001/;
      proxy_redirect         / /pad/;
      proxy_set_header       Host $host;
      proxy_buffering off;
  }
This makes http://box.somewhere.com/pad work -> but create a new random pad and it goes to /p/RANDOMID which is a 404. 

I tried adding the following location, but it isn't working.

  location ^~ /p/ {
      proxy_pass             http://box.somewhere.com:9001/;
      proxy_set_header       Host $host;
      proxy_buffering off;
}

Are there more NGINX tricks to make this happen, or is there a way to set the base-url for Etherpad lite so I wouldn't need the rewrite voodoo?

Of course, I've noticed in the examples for the "pretty urls" that there are also a dozen other URL locations besides "/p" that need to be dealt with too. (https://github.com/Pita/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy)

Thanks in advance for any advice. :-)
-Tim


whatbedo

unread,
Mar 27, 2012, 1:38:42 AM3/27/12
to EtherPad Open Source Discussion
hi.

i found that you get the [/pad going to the /p/RANDOMID] behavior when
you don't place a slash at the end. if you do place one (ie.
box.somewhere.com/pad/), you'll be directed to box.somewhere.com/pad/p/
RANDOMID, which is what you want.

as for trying to get prettier uri's working with nginx, i'm on that
boat as well.

--- whatbedo

On Mar 9, 7:17 pm, Tim Colson <timcol...@gmail.com> wrote:
> Hi folks --
>
> I want to front Etherpad-Lite on a linux machine athttp://box.somewhere.com:9001withhttp://box.somewhere.com/note-- i.e.
> port 80 and a different sub-directory, not a virtual host, no https.
>
> After much pain with Apache, I decided to try my hand at NGINX (since the
> config looked simpler).
>
>   location /pad {
>       rewrite                /pad/(.*) /$1 break;
>       proxy_pass            http://localhost:9001/;
>       proxy_redirect         / /pad/;
>       proxy_set_header       Host $host;
>       proxy_buffering off;
>   }
>
> This makeshttp://box.somewhere.com/padwork -> but create a new random pad
> and it goes to /p/RANDOMID which is a 404.
>
> I tried adding the following location, but it isn't working.
>
>   location ^~ /p/ {
>       proxy_pass            http://box.somewhere.com:9001/;
>       proxy_set_header       Host $host;
>       proxy_buffering off;
>
> }
>
> Are there more NGINX tricks to make this happen, or is there a way to set
> the base-url for Etherpad lite so I wouldn't need the rewrite voodoo?
>
> Of course, I've noticed in the examples for the "pretty urls" that there
> are also a dozen other URL locations besides "/p" that need to be dealt
> with too.
> (https://github.com/Pita/etherpad-lite/wiki/How-to-put-Etherpad-Lite-b...)

whatbedo

unread,
Mar 27, 2012, 6:08:46 AM3/27/12
to EtherPad Open Source Discussion
hi, (hope i'm not double-posting)

i've been playing around with etherpad-lite on nginx, and fixed the
same 404 problem you describe passing a trailing slash (/pad/) to
etherpad.
i made it easier for myself using rewrite, which puts in a slash for
me:

rewrite ^/pad$ /pad/ permanent;

hope it helps. have fun playing with this fantastic software; i sure
am,
---whatbedo

On Mar 9, 7:17 pm, Tim Colson <timcol...@gmail.com> wrote:
> Hi folks --
>
> I want to front Etherpad-Lite on a linux machine athttp://box.somewhere.com:9001withhttp://box.somewhere.com/note-- i.e.
> port 80 and a different sub-directory, not a virtual host, no https.
>
> After much pain with Apache, I decided to try my hand at NGINX (since the
> config looked simpler).
>
>   location /pad {
>       rewrite                /pad/(.*) /$1 break;
>       proxy_pass            http://localhost:9001/;
>       proxy_redirect         / /pad/;
>       proxy_set_header       Host $host;
>       proxy_buffering off;
>   }
>
> This makeshttp://box.somewhere.com/padwork -> but create a new random pad
> and it goes to /p/RANDOMID which is a 404.
>
> I tried adding the following location, but it isn't working.
>
>   location ^~ /p/ {
>       proxy_pass            http://box.somewhere.com:9001/;
>       proxy_set_header       Host $host;
>       proxy_buffering off;
>
> }
>
> Are there more NGINX tricks to make this happen, or is there a way to set
> the base-url for Etherpad lite so I wouldn't need the rewrite voodoo?
>
> Of course, I've noticed in the examples for the "pretty urls" that there
> are also a dozen other URL locations besides "/p" that need to be dealt
> with too.
> (https://github.com/Pita/etherpad-lite/wiki/How-to-put-Etherpad-Lite-b...)
Reply all
Reply to author
Forward
0 new messages