Skip to content

fix: remove localhost default from MarketingURL#6

Merged
mastermanas805 merged 1 commit intomasterfrom
fix/default-marketing-url-empty
Apr 23, 2026
Merged

fix: remove localhost default from MarketingURL#6
mastermanas805 merged 1 commit intomasterfrom
fix/default-marketing-url-empty

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Problem

The default value for `Server.MarketingURL` in `DefaultConfig` was
`"http://localhost:5173"\`. In local dev this is fine. In production,
any deploy where the operator hadn't configured a `MARKETING_URL`
env var had every post-OAuth login redirect land on
`http://localhost:5173/dashboard.html\` — real users bounced to their
own laptop.

Live symptom (reported by a user): "Why is login redirecting to
http://localhost:5173/dashboard.html?"

Fix

Change default to `""`. The existing branch `if s.marketingURL != ""`
in the redirect handlers falls through to a 404 (or path-only
redirect), which is ugly but correct — a misconfigured deploy fails
clean instead of silently shipping every signup to localhost.

Added a regression test in `config_test.go` so the localhost string
can't sneak back in.

Relationship to PR #5

PR #5 adds `marketing_url: "${MARKETING_URL}"` to
`config.prod.yaml.tpl`. Once that merges AND the operator sets the
`MARKETING_URL` env var on DO, prod redirects work correctly. This
PR is the belt-and-braces defense for the interim (and for any future
self-hoster who forgets the env var).

Verification

```
go build ./... # clean
go vet ./... # clean
go test ./... # all pass
```

The default for Server.MarketingURL was "http://localhost:5173" —
harmless in local dev, catastrophic in production where an operator
who hadn't configured MARKETING_URL (most of them) would have every
post-OAuth redirect land on http://localhost:5173/dashboard.html.

Dropping it to "" keeps the existing "if empty, 404 the marketing
redirects" branch active, so a misconfigured deploy fails clean
instead of silently shipping every signup to their own localhost.

The proper prod config (config.prod.yaml.tpl wiring MARKETING_URL
+ COOKIE_DOMAIN) is in PR #5. This change makes unset env vars
safe even before PR #5 lands.
@mastermanas805 mastermanas805 merged commit a2f4030 into master Apr 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant