fix: remove localhost default from MarketingURL#6
Merged
mastermanas805 merged 1 commit intomasterfrom Apr 23, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
```