SetBaseURL sets the public base URL used for generating shareable links. If the supplied URL has an unspecified bind-all host ("0.0.0.0", "::", "[::]"), this logs a WARN: such a URL is the right thing to *bind* to but the wrong thing to *send* to a recipient (their browser cannot resolve 0.0.0.0 /
(rawURL string)
| 510 | // links from such a deployment should set PAD_URL or PUBLIC_URL to the |
| 511 | // real public hostname (e.g. https://app.getpad.dev). See BUG-899. |
| 512 | func (s *Server) SetBaseURL(rawURL string) { |
| 513 | s.baseURL = strings.TrimRight(rawURL, "/") |
| 514 | if s.baseURL == "" { |
| 515 | return |
| 516 | } |
| 517 | if u, err := url.Parse(s.baseURL); err == nil { |
| 518 | switch u.Hostname() { |
| 519 | case "", "0.0.0.0", "::": |
| 520 | slog.Warn("server base URL has an unspecified host; emailed links (password reset, invites, share links) will not be reachable. Set PAD_URL or PUBLIC_URL to the deployment's public URL (e.g. https://app.getpad.dev).", "base_url", s.baseURL) |
| 521 | } |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | // specialUseTLDs is the (finite) set of reserved top-level names from the IANA |
| 526 | // Special-Use Domain Names registry + related RFCs that never resolve to a |
no outgoing calls