about summary refs log tree commit diff
path: root/docs/nginx.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/nginx.md')
-rw-r--r--docs/nginx.md55
1 files changed, 31 insertions, 24 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