Production URLs: recommend URL_PORT=:443, strip default ports

A missing URL_PORT defaults to :8080, and deploy panels often can't store
an empty value, so production kept ORIGIN=https://admin.<domain>:8080 and
the admin login still failed with "Cross-site POST form submissions are
forbidden" (reproduced against production). URL_PORT=:443 is non-empty
and adapter-node normalises it away (new URL().origin).

The PUBLIC_* URLs are used verbatim in saved image URLs, email links and
the admin's View link, so they now go through baseUrl(), which drops
default ports and trailing slashes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
This commit is contained in:
agent 2026-10-07 14:56:53 +00:00
parent 7b6c8c2511
commit bf4c619074
10 changed files with 34 additions and 13 deletions

View file

@ -32,10 +32,11 @@ SITE_TIMEZONE=Europe/Oslo
# Public URLs the browser uses: <URL_SCHEME>://admin.<DOMAIN><URL_PORT>.
# They must match the address bar exactly (SvelteKit's form CSRF check).
# Local default: http + :8080. Behind a reverse proxy / TLS on 443, e.g.:
# Local default: http + :8080. Behind a reverse proxy / TLS on 443:
# URL_SCHEME=https
# URL_PORT=
# (empty URL_PORT = no port in the URL; leave the line out to get :8080)
# URL_PORT=:443
# (:443 is the https default, so URLs come out without a port. An empty
# value works too; a MISSING URL_PORT means :8080.)
DOMAIN=localhost
URL_SCHEME=http
URL_PORT=:8080