From 73859ebc11c8d3f44e365cb5904afb1071bc9a3d Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 21 Jan 2024 13:07:07 +0000 Subject: [PATCH] Do not use redirect on /cgi-bin/newemail.py Delta Chat does not follow redirects, so it breaks old QR codes printed on paper and published on various web pages. --- cmdeploy/src/cmdeploy/nginx/nginx.conf.j2 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmdeploy/src/cmdeploy/nginx/nginx.conf.j2 b/cmdeploy/src/cmdeploy/nginx/nginx.conf.j2 index 09ef5cde..4a2743eb 100644 --- a/cmdeploy/src/cmdeploy/nginx/nginx.conf.j2 +++ b/cmdeploy/src/cmdeploy/nginx/nginx.conf.j2 @@ -58,8 +58,19 @@ http { } # Old URL for compatibility with e.g. printed QR codes. + # + # Copy-paste instead of redirect to /new + # because Delta Chat core does not follow redirects. + # + # Redirects are only for browsers. location /cgi-bin/newemail.py { - return 301 /new; + if ($request_method = GET) { + return 301 dcaccount:https://{{ config.domain_name }}/new; + } + + fastcgi_pass unix:/run/fcgiwrap.socket; + include /etc/nginx/fastcgi_params; + fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/newemail.py; } }