diff --git a/hosts/prophet/services/cdn-shield/default.nix b/hosts/prophet/services/cdn-shield/default.nix index b1cf7f8..576a92a 100644 --- a/hosts/prophet/services/cdn-shield/default.nix +++ b/hosts/prophet/services/cdn-shield/default.nix @@ -8,4 +8,7 @@ let in { services.nginx.virtualHosts = tools.mappers.mapSubdomains (import ./shields.nix { inherit tools; }); + services.nginx.appendHttpConfig = '' + proxy_cache_path /var/cache/nginx/wttr levels=1:2 keys_zone=wttr:10m max_size=100m inactive=30d use_temp_path=off; + ''; } diff --git a/hosts/prophet/services/cdn-shield/shields.nix b/hosts/prophet/services/cdn-shield/shields.nix index cb2b67e..776f59e 100644 --- a/hosts/prophet/services/cdn-shield/shields.nix +++ b/hosts/prophet/services/cdn-shield/shields.nix @@ -4,4 +4,16 @@ with tools.vhosts; "fonts-googleapis-com" = proxyGhost "https" "fonts.googleapis.com"; "fonts-gstatic-com" = proxyGhost "https" "fonts.gstatic.com"; "cdnjs-cloudflare-com" = proxyGhost "https" "cdnjs.cloudflare.com"; + "wttr-in" = let + proxy = proxyGhost "https" "wttr.in"; + in proxy // { + locations."/".extraConfig = proxy.locations."/".extraConfig + '' + proxy_cache wttr; + proxy_cache_key $uri; + proxy_cache_min_uses 1; + proxy_cache_methods GET HEAD POST; + proxy_cache_valid any 10m; + proxy_cache_bypass $cookie_nocache $arg_nocache$arg_comment; + ''; + }; }