fix(castopod): Add support for HEAD requests using an nginx trick

This commit is contained in:
sinavir 2023-11-08 22:31:03 +01:00
parent 0a65b4894f
commit d0c6caac7c

View file

@ -266,7 +266,7 @@ new file mode 100644
index 00000000000000..b782b548914795 index 00000000000000..b782b548914795
--- /dev/null --- /dev/null
+++ b/nixos/modules/services/audio/castopod.nix +++ b/nixos/modules/services/audio/castopod.nix
@@ -0,0 +1,287 @@ @@ -0,0 +1,297 @@
+{ config, lib, pkgs, ... }: +{ config, lib, pkgs, ... }:
+let +let
+ cfg = config.services.castopod; + cfg = config.services.castopod;
@ -522,6 +522,14 @@ index 00000000000000..b782b548914795
+ index index.php index.html; + index index.php index.html;
+ ''; + '';
+ +
+ locations."@force_get" = {
+ extraConfig = ''
+ recursive_error_pages on;
+ proxy_method GET;
+ proxy_pass https://podcasts.dgnum.eu;
+ '';
+ };
+
+ locations."^~ /${cfg.settings."media.root"}/" = { + locations."^~ /${cfg.settings."media.root"}/" = {
+ root = cfg.settings."media.storage"; + root = cfg.settings."media.storage";
+ extraConfig = '' + extraConfig = ''
@ -536,6 +544,8 @@ index 00000000000000..b782b548914795
+ SERVER_NAME = "$host"; + SERVER_NAME = "$host";
+ }; + };
+ extraConfig = '' + extraConfig = ''
+ error_page 550 = @force_get;
+ if ($request_method = HEAD) { return 550; }
+ fastcgi_intercept_errors on; + fastcgi_intercept_errors on;
+ fastcgi_index index.php; + fastcgi_index index.php;
+ fastcgi_pass unix:${fpm.socket}; + fastcgi_pass unix:${fpm.socket};