nixos/mediawiki: fix rewrites for static ressources and rest API

This commit is contained in:
Jörg Thalheim 2023-11-04 14:10:45 +01:00 committed by Jörg Thalheim
parent b645bf2f1b
commit 915ad8a77b

View File

@ -552,24 +552,20 @@ in
deny all; deny all;
''; '';
# MediaWiki assets (usually images) # MediaWiki assets (usually images)
"~ ^/w/resources/(assets|lib|src)" = { "~ ^/w/resources/(assets|lib|src)".extraConfig = ''
tryFiles = "$uri =404"; rewrite ^/w(/.*) $1 break;
extraConfig = '' add_header Cache-Control "public";
add_header Cache-Control "public"; expires 7d;
expires 7d; '';
'';
};
# Assets, scripts and styles from skins and extensions # Assets, scripts and styles from skins and extensions
"~ ^/w/(skins|extensions)/.+\\.(css|js|gif|jpg|jpeg|png|svg|wasm|ttf|woff|woff2)$" = { "~ ^/w/(skins|extensions)/.+\\.(css|js|gif|jpg|jpeg|png|svg|wasm|ttf|woff|woff2)$".extraConfig = ''
tryFiles = "$uri =404"; rewrite ^/w(/.*) $1 break;
extraConfig = '' add_header Cache-Control "public";
add_header Cache-Control "public"; expires 7d;
expires 7d; '';
'';
};
# Handling for Mediawiki REST API, see [[mw:API:REST_API]] # 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) # Handling for the article path (pretty URLs)
"/wiki/".extraConfig = '' "/wiki/".extraConfig = ''