Refactor jellyfin nginx config
This commit is contained in:
parent
a3f1bace8a
commit
a1b6b40396
1 changed files with 15 additions and 7 deletions
|
@ -83,6 +83,7 @@ begin
|
||||||
"$_flag_name" / "" (
|
"$_flag_name" / "" (
|
||||||
for app in $servarr
|
for app in $servarr
|
||||||
printf "%s\n" "$app" "/$app" ""
|
printf "%s\n" "$app" "/$app" ""
|
||||||
|
printf "%s\n" "$app" "/$app/signalr" ""
|
||||||
end) \
|
end) \
|
||||||
flood "/flood/"
|
flood "/flood/"
|
||||||
end
|
end
|
||||||
|
@ -107,22 +108,29 @@ begin
|
||||||
'return 302 $scheme://$host$uri/$is_args$args;' \
|
'return 302 $scheme://$host$uri/$is_args$args;' \
|
||||||
"}"
|
"}"
|
||||||
else
|
else
|
||||||
getServiceDefaultProxy $argv --path "$location"
|
getServiceDefaultProxy $argv
|
||||||
end
|
end
|
||||||
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 [ "$s" = "$service" ]
|
||||||
if [ "$location" = / ]
|
if [ "$location" = / ]
|
||||||
printf "%s\n" \
|
printf "%s\n" \
|
||||||
"# Disable buffering when the nginx proxy gets very resource heavy upon streaming" \
|
"# Disable buffering when the nginx proxy gets very resource heavy upon streaming" \
|
||||||
"proxy_buffering off;"
|
"proxy_buffering off;"
|
||||||
else if [ "$location" = /socket ]
|
else if [ "$location" = /socket ]
|
||||||
printf "%s\n" \
|
echo "$wsConfig"
|
||||||
'# Websocket' \
|
end
|
||||||
"proxy_http_version 1.1;" \
|
else if contains "$s" $servarr
|
||||||
'proxy_set_header Upgrade $http_upgrade;' \
|
if string match --regex ".*/signalr^" "$location" >/dev/null
|
||||||
'proxy_set_header Connection "upgrade";'
|
echo "$wsConfig"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue