From f8aa276c36a4738f1e1848eca9ed32c635185aee Mon Sep 17 00:00:00 2001 From: Santosh Tharu Date: Sat, 27 Jul 2024 16:59:46 +0545 Subject: [PATCH] entrypoint fixes --- entrypoint.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 1b03768c4..4920d167d 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,19 @@ #!/bin/sh # replace /__ENTRYPOINT__ with the runtime-configured entrypoint +if [ "$ALLOWED_FRAME_URLS" = "" ]; then + # root entrypoint is handled differently from non-root, in particular + # - basePath="" rather than "/" + # - an extra redirect is added /x/ => /x -- but with root that would be // => / which is invalid + cp .next/routes-manifest.json .next/routes-manifest.json.in + jq -rc '.basePath = "" + | .redirects = [ + .redirects + | .[] + | select((.source == "/__ENTRYPOINT__/" and .destination == "/__ENTRYPOINT__") | not) + ]' .next/routes-manifest.json.in > .next/routes-manifest.json +fi + escaped_frame_urls=$(echo "$ALLOWED_FRAME_URLS" | sed 's/\//\\\//g') echo "Replacing /__ENTRYPOINT__ in all .next file..."