From 9073cc3248f060b010c4b7a58f37b47a49982ba6 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 12 Oct 2012 17:06:53 -0700 Subject: [PATCH] Rewrite /p/ on etherpad. Also, actually redirect on incorrect hostnames. Change-Id: I4e0981e45ed119eff02027e90a6a983ddeb6138b Reviewed-on: https://review.openstack.org/14420 Reviewed-by: Monty Taylor Reviewed-by: Clark Boylan Reviewed-by: Paul Belanger Approved: James E. Blair Tested-by: Jenkins --- templates/etherpadlite.vhost.erb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/templates/etherpadlite.vhost.erb b/templates/etherpadlite.vhost.erb index 6ac0aec..e9802a5 100644 --- a/templates/etherpadlite.vhost.erb +++ b/templates/etherpadlite.vhost.erb @@ -35,9 +35,25 @@ RewriteEngine on RewriteCond %{HTTP_HOST} !<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %> - RewriteRule ^.*$ https://<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %> - RewriteRule ^/(.*)$ http://localhost:9001/$1 [P] + RewriteRule ^.*$ https://<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %> [L,R=301] + RewriteRule ^/p/(.*)$ https://<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>/$1 [NC,L,R=301] + RewriteCond %{REQUEST_URI} !^/p/ + RewriteCond %{REQUEST_URI} !^/static/ + RewriteCond %{REQUEST_URI} !^/pluginfw/ + RewriteCond %{REQUEST_URI} !^/javascripts/ + RewriteCond %{REQUEST_URI} !^/socket.io/ + RewriteCond %{REQUEST_URI} !^/ep/ + RewriteCond %{REQUEST_URI} !^/minified/ + RewriteCond %{REQUEST_URI} !^/api/ + RewriteCond %{REQUEST_URI} !^/ro/ + RewriteCond %{REQUEST_URI} !^/error/ + RewriteCond %{REQUEST_URI} !^/jserror + RewriteCond %{REQUEST_URI} !/favicon.ico + RewriteCond %{REQUEST_URI} !/robots.txt + RewriteRule ^/+(.+)$ https://<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>/p/$1 + + RewriteRule ^/(.*)$ http://localhost:9001/$1 [P] ProxyPassReverse / http://localhost:9001/