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)
| 502 | // links from such a deployment should set PAD_URL or PUBLIC_URL to the |
| 503 | // real public hostname (e.g. https://app.getpad.dev). See BUG-899. |
| 504 | func (s *Server) SetBaseURL(rawURL string) { |
| 505 | s.baseURL = strings.TrimRight(rawURL, "/") |
| 506 | if s.baseURL == "" { |
| 507 | return |
| 508 | } |
| 509 | if u, err := url.Parse(s.baseURL); err == nil { |
| 510 | switch u.Hostname() { |
| 511 | case "", "0.0.0.0", "::": |
| 512 | 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) |
| 513 | } |
| 514 | } |
| 515 | } |
| 516 | |
| 517 | // specialUseTLDs is the (finite) set of reserved top-level names from the IANA |
| 518 | // Special-Use Domain Names registry + related RFCs that never resolve to a |
no outgoing calls