From 57eeb1be332d0f73f882dc88179671aed86b67e7 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 24 Jul 2024 21:49:26 +0300 Subject: [PATCH] Upgrade Cinny (v3.2.0 -> v4.0.0) and adapt our custom nginx configuration with the new URL rewrites Cinny includes nginx configuration which does URL rewrites now, as seen here: https://raw.githubusercontent.com/cinnyapp/cinny/dev/docker-nginx.conf That said, we have our own nginx configuration for Cinny, because we'd like to run ngin as non-root and on a non-privileged port (80 -> 8080). For this reason, we override `/etc/nginx/nginx.conf` and need to duplicate what we see in `/etc/nginx/conf.d/default.conf` with our own `server` block (which listens on port 8080). --- .../matrix-client-cinny/defaults/main.yml | 2 +- .../templates/nginx.conf.j2 | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/roles/custom/matrix-client-cinny/defaults/main.yml b/roles/custom/matrix-client-cinny/defaults/main.yml index bd3da6166..9c829044d 100644 --- a/roles/custom/matrix-client-cinny/defaults/main.yml +++ b/roles/custom/matrix-client-cinny/defaults/main.yml @@ -7,7 +7,7 @@ matrix_client_cinny_container_image_self_build: false matrix_client_cinny_container_image_self_build_repo: "https://github.com/ajbura/cinny.git" # renovate: datasource=docker depName=ajbura/cinny -matrix_client_cinny_version: v3.2.0 +matrix_client_cinny_version: v4.0.0 matrix_client_cinny_docker_image: "{{ matrix_client_cinny_docker_image_name_prefix }}ajbura/cinny:{{ matrix_client_cinny_version }}" matrix_client_cinny_docker_image_name_prefix: "{{ 'localhost/' if matrix_client_cinny_container_image_self_build else matrix_container_global_registry_prefix }}" matrix_client_cinny_docker_image_force_pull: "{{ matrix_client_cinny_docker_image.endswith(':latest') }}" diff --git a/roles/custom/matrix-client-cinny/templates/nginx.conf.j2 b/roles/custom/matrix-client-cinny/templates/nginx.conf.j2 index fba16bbdc..3ae9cae7d 100644 --- a/roles/custom/matrix-client-cinny/templates/nginx.conf.j2 +++ b/roles/custom/matrix-client-cinny/templates/nginx.conf.j2 @@ -51,16 +51,20 @@ http { root /usr/share/nginx/html; location / { - index index.html index.htm; - } + # Inspired by: https://raw.githubusercontent.com/cinnyapp/cinny/dev/docker-nginx.conf - location ~* ^/(config(.+)?\.json$|(.+)\.html$|i18n) { - expires -1; - } - - error_page 500 502 503 504 /50x.html; - location = /50x.html { root /usr/share/nginx/html; + + rewrite ^/config.json$ /config.json break; + rewrite ^/manifest.json$ /manifest.json break; + + rewrite ^.*/olm.wasm$ /olm.wasm break; + rewrite ^/pdf.worker.min.js$ /pdf.worker.min.js break; + + rewrite ^/public/(.*)$ /public/$1 break; + rewrite ^/assets/(.*)$ /assets/$1 break; + + rewrite ^(.+)$ /index.html break; } } }