diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2023-11-04 14:10:45 +0100 |
---|---|---|
committer | Jörg Thalheim <Mic92@users.noreply.github.com> | 2023-11-06 22:52:42 +0100 |
commit | 915ad8a77b9f0b83bd69716464df887afb3aa682 (patch) | |
tree | d9d635453858e182ddc74728cd42cf4b29ca872b /nixos | |
parent | b645bf2f1bc34bb547605038b62dbb355bdb6de4 (diff) |
nixos/mediawiki: fix rewrites for static ressources and rest API
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/web-apps/mediawiki.nix | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/nixos/modules/services/web-apps/mediawiki.nix b/nixos/modules/services/web-apps/mediawiki.nix index c5fb03766899..54e33a9d56cb 100644 --- a/nixos/modules/services/web-apps/mediawiki.nix +++ b/nixos/modules/services/web-apps/mediawiki.nix @@ -552,24 +552,20 @@ in deny all; ''; # MediaWiki assets (usually images) - "~ ^/w/resources/(assets|lib|src)" = { - tryFiles = "$uri =404"; - extraConfig = '' - add_header Cache-Control "public"; - expires 7d; - ''; - }; + "~ ^/w/resources/(assets|lib|src)".extraConfig = '' + rewrite ^/w(/.*) $1 break; + add_header Cache-Control "public"; + expires 7d; + ''; # Assets, scripts and styles from skins and extensions - "~ ^/w/(skins|extensions)/.+\\.(css|js|gif|jpg|jpeg|png|svg|wasm|ttf|woff|woff2)$" = { - tryFiles = "$uri =404"; - extraConfig = '' - add_header Cache-Control "public"; - expires 7d; - ''; - }; + "~ ^/w/(skins|extensions)/.+\\.(css|js|gif|jpg|jpeg|png|svg|wasm|ttf|woff|woff2)$".extraConfig = '' + rewrite ^/w(/.*) $1 break; + add_header Cache-Control "public"; + expires 7d; + ''; # Handling for Mediawiki REST API, see [[mw:API:REST_API]] - "/w/rest.php".tryFiles = "$uri $uri/ /rest.php?$query_string"; + "/w/rest.php/".tryFiles = "$uri $uri/ /w/rest.php?$query_string"; # Handling for the article path (pretty URLs) "/wiki/".extraConfig = '' |