Skip to content

Commit cd2b99c

Browse files
Merge pull request #244 from NuschtOS/matrix
matrix: use priority instead of regex hacks
2 parents d331edb + 3781319 commit cd2b99c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

modules/matrix.nix

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,20 @@ in
166166
forceSSL = lib.mkIf cfg.recommendedDefaults true;
167167
locations = {
168168
"= /admin".return = "307 /admin/";
169-
"^~ /admin/" = {
169+
"/admin/" = {
170170
alias = "${cfga.package}/";
171+
priority = 500;
171172
tryFiles = "$uri $uri/ /index.html";
172173
};
173-
"~ ^/admin/.*\.(?:css|js|jpg|jpeg|gif|png|svg|ico|woff|woff2|ttf|eot|webp)$".extraConfig = /* nginx */ ''
174-
expires 30d;
175-
more_set_headers "Cache-Control: public";
176-
'';
174+
"~ ^/admin/.*\\.(?:css|js|jpg|jpeg|gif|png|svg|ico|woff|woff2|ttf|eot|webp)$" = {
175+
priority = 400;
176+
root = cfga.package;
177+
extraConfig = /* nginx */ ''
178+
rewrite ^/admin/(.*)$ /$1 break;
179+
expires 30d;
180+
more_set_headers "Cache-Control: public";
181+
'';
182+
};
177183
};
178184
};
179185
})

0 commit comments

Comments
 (0)