about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr Prins <pjotr.public01@thebird.nl>2026-12-01 12:44:33 +0000
committerPjotr Prins <pjotr.public01@thebird.nl>2026-12-01 12:44:33 +0000
commit2a85f5c19d6801ed7c0f0a1ee63cefcb85c4161b (patch)
tree671cdf45aef45d21070878cb98bf9c8fdb527f4e
parentc8df59447aba3f1dffcafe8ebb71cf62c4098e36 (diff)
downloadgenenetwork4-2a85f5c19d6801ed7c0f0a1ee63cefcb85c4161b.tar.gz
nginx: serve the canonical name first, keep the old one
romeral.systemsgenetics.org leads server_name in both server blocks and the
old name follows it, because it is still served and still has to be: the
published links are not all updated yet. Nothing else about the two-name setup
changes -- one certificate with both SANs, one redirect to $host.

The header now records that the certificate is named after the old domain for
historical reasons (its subjectAltNames are what matter), that the renewal
must keep both names, and that `certbot --nginx' is the thing that broke this
deployment and must not be used.

Not installed on the host: the live nginx keeps its current settings for a few
weeks, and this file is what goes in when the old name is retired -- at which
point the only edit needed is dropping vesuvio from the two server_name lines.
-rw-r--r--docs/nginx.md55
-rw-r--r--etc/nginx-vesuvio.pu.ac.ke.conf23
2 files changed, 46 insertions, 32 deletions
diff --git a/docs/nginx.md b/docs/nginx.md
index 2d7cafe..14f93d0 100644
--- a/docs/nginx.md
+++ b/docs/nginx.md
@@ -1,10 +1,16 @@
 # Publishing genenetwork4 under a path prefix with nginx
 
-How to put genenetwork4 on `https://vesuvio.pu.ac.ke/gn4/` while the
-server itself listens on a loopback port, with no gn-auth: a bearer
+How to put genenetwork4 on `https://romeral.systemsgenetics.org/gn4/` while
+the server itself listens on a loopback port, with no gn-auth: a bearer
 token minted from `scripts/gn-auth-stub.py` (see "Authentication"
 below).
 
+`romeral.systemsgenetics.org` is the authoritative name (it is behind
+Cloudflare); `https://vesuvio.pu.ac.ke/gn4/` still answers, and will until the
+old links have aged out, so both names are in `server_name` and in one
+certificate. Nothing below depends on which of the two is used, except the
+examples, which use the canonical one.
+
 Three things separate this from "just proxy it":
 
 - genenetwork4 assumes it is served at `/`. Every link it emits is
@@ -55,10 +61,10 @@ proxy being misconfigured. See docs/search-engines.md.
 server {
     listen 443 ssl;
     http2 on;
-    server_name vesuvio.pu.ac.ke;
+    server_name romeral.systemsgenetics.org vesuvio.pu.ac.ke;
 
-    ssl_certificate     /etc/nginx/ssl/vesuvio.pu.ac.ke.pem;
-    ssl_certificate_key /etc/nginx/ssl/vesuvio.pu.ac.ke.key;
+    ssl_certificate     /etc/nginx/ssl/romeral.systemsgenetics.org.pem;
+    ssl_certificate_key /etc/nginx/ssl/romeral.systemsgenetics.org.key;
 
     # genenetwork4 is mounted at /gn4/. The trailing slash on proxy_pass
     # is what translates the prefix away: /gn4/species -> /species.
@@ -156,7 +162,7 @@ alphabetical order and nginx uses the **first** server block whose
 one nginx discards. The only sign is a warning at startup or reload --
 
 ```
-nginx: [warn] conflicting server name "vesuvio.pu.ac.ke" on 0.0.0.0:443, ignored
+nginx: [warn] conflicting server name "romeral.systemsgenetics.org" on 0.0.0.0:443, ignored
 ```
 
 -- and the symptoms are a stock "Welcome to nginx!" page at `/` and
@@ -167,7 +173,7 @@ certbot-managed `server` block for this hostname) and reload; grep the
 error log for `conflicting server name` after any change to the vhost
 set.
 
-For the `vesuvio.pu.ac.ke/gn4` deployment as configured,
+For the `romeral.systemsgenetics.org/gn4` deployment as configured,
 [`etc/nginx-vesuvio.pu.ac.ke.conf`](../etc/nginx-vesuvio.pu.ac.ke.conf) is
 the same thing as a complete, drop-in file -- TLS, log format, the `/gn4`
 redirect, and the `/get-test-token` refusal. `/compute/*` (R/qtl, GEMMA)
@@ -190,8 +196,8 @@ with `/gn4/...` hrefs, and an error body comes back with
 Every success envelope carries `next: [{"href": ...}]`, and every error
 carries `spec_url`, `type` and sometimes `next`. All of them are
 root-relative by design -- genenetwork4 has no idea it is behind a
-prefix -- so a client at `https://vesuvio.pu.ac.ke/gn4/species` is told
-to call `https://vesuvio.pu.ac.ke/groups`.
+prefix -- so a client at `https://romeral.systemsgenetics.org/gn4/species` is told
+to call `https://romeral.systemsgenetics.org/groups`.
 
 Three ways to deal with that, in order of preference:
 
@@ -224,7 +230,7 @@ Three ways to deal with that, in order of preference:
 
 `/openapi.json` itself is served fine through the proxy. Its `paths` are
 root-relative, which is correct OpenAPI: a tool that reads the document
-from `https://vesuvio.pu.ac.ke/gn4/openapi.json` resolves them under
+from `https://romeral.systemsgenetics.org/gn4/openapi.json` resolves them under
 `/gn4` on its own. A tool that hard-codes `paths` against the host root
 will call the wrong place -- that is the same prefix problem, one level
 further out.
@@ -271,13 +277,13 @@ docs/gn-auth.md.
 From a client, plainly:
 
 ```
-curl -s https://vesuvio.pu.ac.ke/gn4/version
-curl -s https://vesuvio.pu.ac.ke/gn4/openapi.json | head -c 200
+curl -s https://romeral.systemsgenetics.org/gn4/version
+curl -s https://romeral.systemsgenetics.org/gn4/openapi.json | head -c 200
 TOKEN=$(cat /run/gn4/public.token)
 curl -s -H "Authorization: Bearer $TOKEN" \
-     "https://vesuvio.pu.ac.ke/gn4/species" | head -c 200
+     "https://romeral.systemsgenetics.org/gn4/species" | head -c 200
 curl -s -H "Authorization: Bearer $TOKEN" \
-     "https://vesuvio.pu.ac.ke/gn4/groups/BXD/traits?limit=3"
+     "https://romeral.systemsgenetics.org/gn4/groups/BXD/traits?limit=3"
 ```
 
 On the box itself, two things trip up the obvious `curl -H "Host: ..."
@@ -285,25 +291,26 @@ https://localhost`:
 
 * TLS validates the **hostname in the URL**, not the `Host:` header, which
   only arrives after the handshake -- so `https://localhost` fails against
-  a certificate for `vesuvio.pu.ac.ke` no matter what `Host:` says. Use
+  a certificate for the name in the URL no matter what `Host:` says. Use
   `--resolve` to connect to loopback while still verifying the real name.
 * use the name that is actually on the certificate. Check it rather than
   assuming (`openssl s_client -connect 127.0.0.1:443 -servername
-  vesuvio.pu.ac.ke </dev/null | openssl x509 -noout -text | grep -A1
-  'Subject Alternative Name'`); a mismatch here and a mismatch in
+  romeral.systemsgenetics.org </dev/null | openssl x509 -noout -text | grep -A1
+  'Subject Alternative Name'`, which must list both names); a mismatch
+  here and a mismatch in
   `server_name` are the same symptom -- the default server answers instead,
   so `/` shows whatever else is configured on the host and `/gn4/...` is a
   404 from nginx rather than from genenetwork4.
 
 ```
-R="--resolve vesuvio.pu.ac.ke:443:127.0.0.1"
-curl -sSI $R https://vesuvio.pu.ac.ke/       | head -3   # 302 -> /gn4/
-curl -sSI $R https://vesuvio.pu.ac.ke/gn4    | head -3   # 301 -> /gn4/
-curl -s   $R https://vesuvio.pu.ac.ke/gn4/version        # the version envelope
+R="--resolve romeral.systemsgenetics.org:443:127.0.0.1"
+curl -sSI $R https://romeral.systemsgenetics.org/       | head -3   # 302 -> /gn4/
+curl -sSI $R https://romeral.systemsgenetics.org/gn4    | head -3   # 301 -> /gn4/
+curl -s   $R https://romeral.systemsgenetics.org/gn4/version        # the version envelope
 curl -s $R -o /dev/null -w '%{http_code}\n' -X POST \
-     https://vesuvio.pu.ac.ke/gn4/get-test-token         # 404: not registered
+     https://romeral.systemsgenetics.org/gn4/get-test-token         # 404: not registered
 curl -s $R -o /dev/null -w '%{http_code}\n' -X POST \
-     https://vesuvio.pu.ac.ke/gn4/compute/correlation    # 401: proxied, token needed
+     https://romeral.systemsgenetics.org/gn4/compute/correlation    # 401: proxied, token needed
 ```
 
 A 502 instead means nginx is fine and genenetwork4 is not listening on
@@ -317,7 +324,7 @@ To check the link rewriting, follow a `next` from a body:
 
 ```
 curl -s -H "Authorization: Bearer $TOKEN" \
-     https://vesuvio.pu.ac.ke/gn4/groups/BXD | grep -o '"href": "[^"]*"' | head -3
+     https://romeral.systemsgenetics.org/gn4/groups/BXD | grep -o '"href": "[^"]*"' | head -3
 ```
 
 Each one should start with `/gn4/`. Without the `sub_filter` lines they
diff --git a/etc/nginx-vesuvio.pu.ac.ke.conf b/etc/nginx-vesuvio.pu.ac.ke.conf
index 79c88b1..eb74500 100644
--- a/etc/nginx-vesuvio.pu.ac.ke.conf
+++ b/etc/nginx-vesuvio.pu.ac.ke.conf
@@ -35,11 +35,17 @@ real_ip_header CF-Connecting-IP;
 # Uncomment with the limit_req line inside the location below.
 # limit_req_zone $binary_remote_addr zone=gn4_per_ip:10m rate=20r/s;
 
-# Two names, one site: vesuvio.pu.ac.ke and romeral.systemsgenetics.org (the
-# latter behind Cloudflare) serve the same GN4. The certificate must cover BOTH:
+# Two names, one site: romeral.systemsgenetics.org is authoritative (it is
+# behind Cloudflare) and vesuvio.pu.ac.ke is the old name, kept answering until the
+# published links have aged out. One certificate must cover BOTH:
 #
-#   sudo certbot --nginx -d vesuvio.pu.ac.ke -d romeral.systemsgenetics.org \
-#        --cert-name vesuvio.pu.ac.ke --expand
+#   sudo certbot certonly --webroot -w /var/www/html \
+#        -d romeral.systemsgenetics.org -d vesuvio.pu.ac.ke --cert-name vesuvio.pu.ac.ke --expand
+#
+# (`--cert-name` stays vesuvio.pu.ac.ke because that is where the live certificate
+# lives; the name is historical, the subjectAltNames are what matter. Do not
+# use `certbot --nginx`: it inserts its own :443 block for the name it is
+# expanding, and that block shadows this one.)
 #
 # and it must stay that way at renewal (certbot renew keeps the names it was
 # asked for). Do not let certbot add a second :443 block for one name: nginx
@@ -48,7 +54,8 @@ real_ip_header CF-Connecting-IP;
 # Cloudflare forwards :80 to this origin, which is why the ACME path below is
 # answered there before the redirect.
 
-# nginx: https://vesuvio.pu.ac.ke/gn4/ -> genenetwork4 on 127.0.0.1:3000
+# nginx: https://romeral.systemsgenetics.org/gn4/ -> genenetwork4 on 127.0.0.1:3000
+#        (and https://vesuvio.pu.ac.ke/gn4/, the old name, which keeps answering)
 #
 # Drop into /etc/nginx/conf.d/ (included from inside nginx's http block) or
 # paste the server block into /etc/nginx/sites-enabled/. The genenetwork4
@@ -84,10 +91,10 @@ real_ip_header CF-Connecting-IP;
 server {
     listen 80;
     listen [::]:80;
-    server_name vesuvio.pu.ac.ke romeral.systemsgenetics.org;
+    server_name romeral.systemsgenetics.org vesuvio.pu.ac.ke;
 
     # ${host} preserves the name the visitor used; a hardcoded name sends
-    # romeral's visitors to vesuvio and vice versa.
+    # the canonical name's visitors to the old one and vice versa.
     location /.well-known/acme-challenge/ { root /var/www/html; }
     location / { return 301 https://$host$request_uri; }
 }
@@ -101,7 +108,7 @@ server {
     listen 443 ssl;
     listen [::]:443 ssl;
     http2 on;                      # nginx >= 1.25.1; else: listen 443 ssl http2;
-    server_name vesuvio.pu.ac.ke romeral.systemsgenetics.org;
+    server_name romeral.systemsgenetics.org vesuvio.pu.ac.ke;
 
     ssl_certificate     /etc/letsencrypt/live/vesuvio.pu.ac.ke/fullchain.pem;
     ssl_certificate_key /etc/letsencrypt/live/vesuvio.pu.ac.ke/privkey.pem;