1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-30 11:37:44 +00:00

Cache assets

This commit is contained in:
RGBCube 2024-02-05 10:21:52 +03:00
parent 1c7731a909
commit 9386715e92
No known key found for this signature in database

View file

@ -4,6 +4,10 @@ let
inherit (config.networking) domain;
port = 8003;
cacheConfig = ''
add_header Cache-Control "public, max-age=10800, immutable";
'';
in serverSystemConfiguration {
services.site = enabled {
inherit port;
@ -11,6 +15,10 @@ in serverSystemConfiguration {
services.nginx.virtualHosts.${domain} = (sslTemplate domain) // {
locations."/".proxyPass = "http://[::]:${toString port}";
locations."/assets" = {
proxyPass = "http://[::]:${toString port}/assets";
extraConfig = cacheConfig;
};
};
services.nginx.virtualHosts."www.${domain}" = (sslTemplate domain) // {
@ -21,6 +29,9 @@ in serverSystemConfiguration {
services.nginx.virtualHosts._ = (sslTemplate domain) // {
locations."/".proxyPass = "http://[::]:${toString port}/404/";
locations."/assets".proxyPass = "http://[::]:${toString port}/assets";
locations."/assets" = {
proxyPass = "http://[::]:${toString port}/assets";
extraConfig = cacheConfig;
};
};
}