From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id NBeMJxr+42DsxAAAgWs5BA (envelope-from ) for ; Tue, 06 Jul 2021 08:54:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id mNWmIhr+42DnVgAA1q6Kng (envelope-from ) for ; Tue, 06 Jul 2021 06:54:18 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AFF9C1AD3B for ; Tue, 6 Jul 2021 08:54:17 +0200 (CEST) Received: from localhost ([::1]:36180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0eyF-0008QL-C0 for larch@yhetil.org; Tue, 06 Jul 2021 02:54:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0ey3-0008Q2-6E for guix-patches@gnu.org; Tue, 06 Jul 2021 02:54:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35583) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m0ey2-0008W1-JW for guix-patches@gnu.org; Tue, 06 Jul 2021 02:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m0ey2-0004U9-Ed for guix-patches@gnu.org; Tue, 06 Jul 2021 02:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49431] [PATCH maintenance.git] nginx: berlin: Redirect old video URLs for each language. Resent-From: "pelzflorian (Florian Pelz)" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 06 Jul 2021 06:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49431 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49431@debbugs.gnu.org Cc: Luis Felipe X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162555440517186 (code B ref -1); Tue, 06 Jul 2021 06:54:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Jul 2021 06:53:25 +0000 Received: from localhost ([127.0.0.1]:47129 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0exQ-0004T7-Cv for submit@debbugs.gnu.org; Tue, 06 Jul 2021 02:53:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:51900) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0exO-0004T0-NN for submit@debbugs.gnu.org; Tue, 06 Jul 2021 02:53:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0exO-0008N1-EN for guix-patches@gnu.org; Tue, 06 Jul 2021 02:53:22 -0400 Received: from pelzflorian.de ([5.45.111.108]:37182 helo=mail.pelzflorian.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0exK-0007qv-Jq for guix-patches@gnu.org; Tue, 06 Jul 2021 02:53:22 -0400 Received: from pelzflorian.localdomain (unknown [5.45.111.108]) by mail.pelzflorian.de (Postfix) with ESMTPSA id B4ED6360672; Tue, 6 Jul 2021 08:53:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=pelzflorian.de; s=mail; t=1625554394; bh=ZJBz8BpikmDUrAfIpuKm/+8lGlQBBujpX1IFZbM5Grs=; h=Date:From:To:Cc:Subject; b=i3grWfYMJMP4rQK8Akl+P/fUnaMGmTgytLzQMd27kAWufk2K488QRS+yva7f4NgSb O4H/WLcx7hJDtsHRXaqtpBNuPo7OEWaBWbusR1JN8dOoWHF+ccQis/TYT66+3yvb3+ iusfkvSqeAtu0TZa/ydfhEGYUlhiNsf0569Q7uJE= Date: Tue, 6 Jul 2021 08:53:04 +0200 From: "pelzflorian (Florian Pelz)" Message-ID: <20210706065304.6kqbwqlcf6calkh7@pelzflorian.localdomain> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="yw3xqgwzlxcaue3q" Content-Disposition: inline Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=5.45.111.108; envelope-from=pelzflorian@pelzflorian.de; helo=mail.pelzflorian.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625554457; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=5Mhcmyeb1VOG+26SDPWktWO58TyEd6MM5vri1FwfSqU=; b=WfDMTjGj7uC8JcfEnX3CqIvNg0ha4GKQWugqF2DALfOLgW+rJpFMqlqojeP95BCSI4bdbU Xq5boDa1LfQOM1JdfdmOUtuVEM20e4a2VRv6FFC/7pM6Kb7ZYsrsH9R8Rxhy7tS8EOjIbo 9HBuIjx0dqcZ9xJRin50vUoEwijSmiDa1KMq18S26DY72b2EuA+2X8wjoUn4KUAYyJ6x7o 1naRoSQKMEYRwq3fVvNvqFT3tFFx2wI9Qt9aHNuVEXafRIZMH3BLWfyJvOpeTNh5ap5OYS gMiMxv8qdTHWz3xXk5tvW80uEU96E6f0k2izZZwDize84D+wzrmuxDKmiVbGKw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625554457; a=rsa-sha256; cv=none; b=dDZwuJ4aW9zWcI8kPE2+hp7L0vMB3VHmlJ9HGr4YfqArpFkpa8OyASCiLDWrKsjvmuNU77 XQCtvm0t95oq9Eh+2GjyUgye3YfquFaqlRVQuAsWNh9uypaSnZtHgM9Trb4Xc7UPwLJ8Zx gQjs738qCX8DNDDvsaQlaujcIoZt5A1bLo4z9ZmSphE0O+NEsm8Fn3nTCkZqrG1OHQFEnh VBt2+irdz7NI9d+nEr7jY1KKlu3LSN+9GGYg5b1Rxk2veOT4FCVg8P29DsGr7ZW5cq6aXg ksDQVb3KVlygGN8Bf58EmQ4FFLAYXli1h73XVJfiLO9binxaKIUm2fPiA9Sa3Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=pelzflorian.de header.s=mail header.b=i3grWfYM; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -0.41 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=pelzflorian.de header.s=mail header.b=i3grWfYM; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: AFF9C1AD3B X-Spam-Score: -0.41 X-Migadu-Scanner: scn0.migadu.com X-TUID: imCqMJA4ojw6 --yw3xqgwzlxcaue3q Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hi guix, a week ago Luis nicely redesigned how videos are displayed on the Guix website . (Because the old CSS stylesheets are cached by the browser, the website displayed videos wrongly for a day though.) This patch adds redirects for the guix website from the old video URLs like /LANG/videos/everyday-use-of-gnu-guix,-part-one/index.html /LANG/videos/everyday-use-of-gnu-guix,-part-one/ /LANG/videos/everyday-use-of-gnu-guix,-part-one to the new /LANG/videos/2020/everyday-use-of-gnu-guix-part-one/ but maybe the patch is too ugly because that’s code duplication to have three added redirections for each video. Note that my old videos page actually linked to and not as usual. Shall I push it as-is to guix/maintenance.git, or do you think it would be better to rewrite the redirect procedure to return a list to redirect every URL with suffixes "" "/" "/index.html" and change guix.gnu.org-locations accordingly to flatten the location list? The patch was tested on a VM of berlin.scm with some services, file systems and SSL removed and I’m confident it does what it should. Regards, Florian --yw3xqgwzlxcaue3q Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="nginx-berlin-Redirect-old-video-URLs-for-each-language.patch" >From d52a189332aa014f9da88fa1ce1e38ffc107fa3b Mon Sep 17 00:00:00 2001 From: Florian Pelz Date: Sun, 4 Jul 2021 14:46:39 +0200 Subject: [PATCH] nginx: berlin: Redirect old video URLs for each language. * hydra/nginx/berlin.scm (languages-to-accept): New list. Move here the languages list from ... (%extra-content) ... here. Use languages from 'languages-to-accept'. (guix.gnu.org-redirect-locations-for-lang): New procedure. Add new video redirections. (guix.gnu.org-redirect-locations): New list. Move here the old redirections. Update old video redirections. (guix.gnu.org-other-locations): New list. Move here the other nginx locations from ... (guix.gnu.org-locations): ... here. Reimplement in terms of the above. --- hydra/nginx/berlin.scm | 78 ++++++++++++++++++++++++++++++++---------- 1 file changed, 60 insertions(+), 18 deletions(-) diff --git a/hydra/nginx/berlin.scm b/hydra/nginx/berlin.scm index 443294e..a8f4690 100644 --- a/hydra/nginx/berlin.scm +++ b/hydra/nginx/berlin.scm @@ -188,7 +188,7 @@ PUBLISH-URL." (body (list "root /var/www/guix;")))))) -(define guix.gnu.org-locations +(define guix.gnu.org-redirect-locations (list ;; Short URL for the installation script (redirect "/install.sh" "https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh") @@ -689,14 +689,46 @@ PUBLISH-URL." (redirect "/screenshots/xfce" "/$lang/screenshots/xfce/") (redirect "/security" "/$lang/security/") (redirect "/videos" "/$lang/videos/") - (redirect "/videos/asking-for-help" "/$lang/videos/asking-for-help/") - (redirect "/videos/everyday-use-of-gnu-guix,-part-one" "/$lang/videos/everyday-use-of-gnu-guix,-part-one/") - (redirect "/videos/everyday-use-of-gnu-guix,-part-two" "/$lang/videos/everyday-use-of-gnu-guix,-part-two/") - (redirect "/videos/installation-from-script" "/$lang/videos/installation-from-script/") - (redirect "/videos/packaging,-part-one" "/$lang/videos/packaging,-part-one/") - (redirect "/videos/packaging,-part-two" "/$lang/videos/packaging,-part-two/") - (redirect "/videos/packaging,-part-three" "/$lang/videos/packaging,-part-three/") - + (redirect "/videos/asking-for-help" "/$lang/videos/2020/asking-for-help/") + (redirect "/videos/everyday-use-of-gnu-guix,-part-one" "/$lang/videos/2020/everyday-use-of-gnu-guix-part-one/") + (redirect "/videos/everyday-use-of-gnu-guix,-part-two" "/$lang/videos/2020/everyday-use-of-gnu-guix-part-two/") + (redirect "/videos/installation-from-script" "/$lang/videos/2020/installation-from-script/") + (redirect "/videos/packaging,-part-one" "/$lang/videos/2020/packaging-part-one/") + (redirect "/videos/packaging,-part-two" "/$lang/videos/2020/packaging-part-two/") + (redirect "/videos/packaging,-part-three" "/$lang/videos/2020/packaging-part-three/"))) + +(define (guix.gnu.org-redirect-locations-for-lang lang) + (define (redirect-lang old new) + (redirect (string-append "/" lang old) + (string-append "/" lang new))) + (list + (redirect-lang "/videos/everyday-use-of-gnu-guix,-part-one" "/videos/2020/everyday-use-of-gnu-guix-part-one/") + (redirect-lang "/videos/everyday-use-of-gnu-guix,-part-two" "/videos/2020/everyday-use-of-gnu-guix-part-two/") + (redirect-lang "/videos/system-graphical-installer" "/videos/2020/system-graphical-installer/") + (redirect-lang "/videos/asking-for-help" "/videos/2020/asking-for-help/") + (redirect-lang "/videos/installation-from-script" "/videos/2020/installation-from-script/") + (redirect-lang "/videos/packaging,-part-one" "/videos/2020/packaging-part-one/") + (redirect-lang "/videos/packaging,-part-two" "/videos/2020/packaging-part-two/") + (redirect-lang "/videos/packaging,-part-three" "/videos/2020/packaging-part-three/") + (redirect-lang "/videos/everyday-use-of-gnu-guix,-part-one/index.html" "/videos/2020/everyday-use-of-gnu-guix-part-one/") + (redirect-lang "/videos/everyday-use-of-gnu-guix,-part-two/index.html" "/videos/2020/everyday-use-of-gnu-guix-part-two/") + (redirect-lang "/videos/system-graphical-installer/index.html" "/videos/2020/system-graphical-installer/") + (redirect-lang "/videos/asking-for-help/index.html" "/videos/2020/asking-for-help/") + (redirect-lang "/videos/installation-from-script/index.html" "/videos/2020/installation-from-script/") + (redirect-lang "/videos/packaging,-part-one/index.html" "/videos/2020/packaging-part-one/") + (redirect-lang "/videos/packaging,-part-two/index.html" "/videos/2020/packaging-part-two/") + (redirect-lang "/videos/packaging,-part-three/index.html" "/videos/2020/packaging-part-three/") + (redirect-lang "/videos/everyday-use-of-gnu-guix,-part-one/" "/videos/2020/everyday-use-of-gnu-guix-part-one/") + (redirect-lang "/videos/everyday-use-of-gnu-guix,-part-two/" "/videos/2020/everyday-use-of-gnu-guix-part-two/") + (redirect-lang "/videos/system-graphical-installer/" "/videos/2020/system-graphical-installer/") + (redirect-lang "/videos/asking-for-help/" "/videos/2020/asking-for-help/") + (redirect-lang "/videos/installation-from-script/" "/videos/2020/installation-from-script/") + (redirect-lang "/videos/packaging,-part-one/" "/videos/2020/packaging-part-one/") + (redirect-lang "/videos/packaging,-part-two/" "/videos/2020/packaging-part-two/") + (redirect-lang "/videos/packaging,-part-three/" "/videos/2020/packaging-part-three/"))) + +(define guix.gnu.org-other-locations + (list (nginx-location-configuration (uri "/guix-videos") (body (list "alias /srv/videos;"))) @@ -754,6 +786,24 @@ PUBLISH-URL." (uri "/.well-known") (body (list "root /var/www;"))))) +(define languages-to-accept + ;; List of languages for redirection; see 'accept-languages' above. + '(("en") + ("de") + ("eo") + ("es") + ("fr") + ("ko") + ("ru") + ("sk") + ("zh-CN" "zh" "zh-Hans" "zh-Hans-CN"))) + +(define guix.gnu.org-locations + (append (append-map guix.gnu.org-redirect-locations-for-lang + (map car languages-to-accept)) + guix.gnu.org-redirect-locations + guix.gnu.org-other-locations)) + (define %publish-url "http://localhost:3000") (define %berlin-servers @@ -1033,15 +1083,7 @@ synonymous IETF language tags that should be mapped to the same $lang." "default_type application/octet-stream;" "sendfile on;" - (accept-languages '(("en") - ("de") - ("eo") - ("es") - ("fr") - ("ko") - ("ru") - ("sk") - ("zh-CN" "zh" "zh-Hans" "zh-Hans-CN"))) + (accept-languages languages-to-accept) ;; Maximum chunk size to send. Partly this is a workaround for ;; , but also the nginx docs mention that -- 2.32.0 --yw3xqgwzlxcaue3q--