mirror of
https://github.com/iflytek/skillhub.git
synced 2026-10-09 03:17:52 +00:00
fix(web): preserve HTTPS in sub-path redirects
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
This commit is contained in:
parent
337d3d973d
commit
e9e570133d
2 changed files with 6 additions and 1 deletions
|
|
@ -86,6 +86,11 @@ if [ "$code" != '301' ]; then
|
|||
echo "bare prefix must 301-redirect, got: $code" >&2
|
||||
exit 1
|
||||
fi
|
||||
location=$(curl -s -o /dev/null -D - "$base/skillhub" | awk 'tolower($1) == "location:" { print $2 }' | tr -d '\r')
|
||||
if [ "$location" != '/skillhub/' ]; then
|
||||
echo "bare prefix redirect must stay relative to preserve an upstream HTTPS scheme, got: $location" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker rm -f "$name" >/dev/null 2>&1 || true
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ if [ "$SKILLHUB_WEB_BASE_PATH" = / ]; then
|
|||
>"$routing_config"
|
||||
else
|
||||
base_path_without_trailing_slash=${SKILLHUB_WEB_BASE_PATH%/}
|
||||
printf 'set $skillhub_forwarded_prefix %s;\n\nlocation = %s {\n return 301 %s/;\n}\n\nlocation ^~ %s {\n rewrite ^%s(.*)$ /$1 last;\n}\n' \
|
||||
printf 'set $skillhub_forwarded_prefix %s;\n\nlocation = %s {\n absolute_redirect off;\n return 301 %s/;\n}\n\nlocation ^~ %s {\n rewrite ^%s(.*)$ /$1 last;\n}\n' \
|
||||
"$base_path_without_trailing_slash" \
|
||||
"$base_path_without_trailing_slash" \
|
||||
"$base_path_without_trailing_slash" \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue