summaryrefslogtreecommitdiffstats
path: root/pad-proxy/templates
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-10-15 22:16:28 -0400
committerSacha Chua <sacha@sachachua.com>2022-10-15 22:16:28 -0400
commit8024842def28dd151759ee46cd160c7794463aef (patch)
tree307795c10fa14b1168e1a8936f816e33e1b985f9 /pad-proxy/templates
parent830f627d38a1476af3a96c554157ee95b03a2ba0 (diff)
downloademacsconf-ansible-8024842def28dd151759ee46cd160c7794463aef.tar.xz
emacsconf-ansible-8024842def28dd151759ee46cd160c7794463aef.zip
Improve pad proxy with templated config, support SSL on pad.emacsconf.org
Diffstat (limited to 'pad-proxy/templates')
-rw-r--r--pad-proxy/templates/etherpad.nginx.conf34
1 files changed, 33 insertions, 1 deletions
diff --git a/pad-proxy/templates/etherpad.nginx.conf b/pad-proxy/templates/etherpad.nginx.conf
index 92ba974..90a7c1c 100644
--- a/pad-proxy/templates/etherpad.nginx.conf
+++ b/pad-proxy/templates/etherpad.nginx.conf
@@ -5,6 +5,19 @@ upstream etherpad_upstream {
server {
listen 80;
server_name {{ etherpad_server_name }};
+ {% if etherpad_tls %}
+ include snippets/well-known-acme-challenge.conf;
+ location / {
+ return 302 https://$server_name$request_uri;
+ }
+ }
+ server {
+ listen 443 ssl http2;
+ listen [::]:443 ssl http2;
+ server_name {{ etherpad_server_name }};
+ include {{ etherpad_tls }};
+
+ {% endif %}
access_log /var/log/nginx/{{ etherpad_server_name }}.access.log;
location ~ ^/(locales/|locales.json|admin/|static/|pluginfw/|javascripts/|socket.io/|ep/|minified/|api/|ro/|error/|jserror/|favicon.ico|robots.txt) {
proxy_buffering off;
@@ -12,7 +25,24 @@ server {
}
location /p/ {
rewrite ^/p/(.*) /$1 redirect;
+ }
+ location /direct/ {
+ rewrite /direct/(.*) /$1 break;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_pass http://etherpad_upstream/p/;
}
+
+ {% if use_wikimedia %}
+ location ~ ^/$ {
+ return 302 https://etherpad.wikimedia.org/p/emacsconf-2022;
+ }
+ location / {
+ rewrite /(.*) https://etherpad.wikimedia.org/p/emacsconf-$1 redirect;
+ }
+ {% else %}
location ~ ^/$ {
proxy_buffering off;
proxy_pass http://etherpad_upstream;
@@ -29,5 +59,7 @@ server {
proxy_pass http://etherpad_upstream/p/;
proxy_redirect / /p/;
proxy_read_timeout 90;
- }
+ }
+ {% endif %}
}
+