Refactor jellyfin nginx config

This commit is contained in:
Manuel Thalmann 2024-12-11 02:27:49 +01:00
parent c349a2d5be
commit 84818c2bac

View file

@ -83,6 +83,7 @@ begin
"$_flag_name" / "" (
for app in $servarr
printf "%s\n" "$app" "/$app" ""
printf "%s\n" "$app" "/$app/signalr" ""
end) \
flood "/flood/"
end
@ -107,22 +108,29 @@ begin
'return 302 $scheme://$host$uri/$is_args$args;' \
"}"
else
getServiceDefaultProxy $argv --path "$location"
getServiceDefaultProxy $argv
end
end
function getExtraLocationSettings -a domain s location -V service
function getExtraLocationSettings -a domain s location -V service -V servarr
set -l wsConfig (
printf "%s\n" \
'# Websocket' \
"proxy_http_version 1.1;" \
'proxy_set_header Upgrade $http_upgrade;' \
'proxy_set_header Connection "upgrade";')
if [ "$s" = "$service" ]
if [ "$location" = / ]
printf "%s\n" \
"# Disable buffering when the nginx proxy gets very resource heavy upon streaming" \
"proxy_buffering off;"
else if [ "$location" = /socket ]
printf "%s\n" \
'# Websocket' \
"proxy_http_version 1.1;" \
'proxy_set_header Upgrade $http_upgrade;' \
'proxy_set_header Connection "upgrade";'
echo "$wsConfig"
end
else if contains "$s" $servarr
if string match --regex ".*/signalr^" "$location" >/dev/null
echo "$wsConfig"
end
end
end