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)
| 1071 | // links from such a deployment should set PAD_URL or PUBLIC_URL to the |
| 1072 | // real public hostname (e.g. https://app.getpad.dev). See BUG-899. |
| 1073 | func (s *Server) SetBaseURL(rawURL string) { |
| 1074 | s.baseURL = strings.TrimRight(rawURL, "/") |
| 1075 | if s.baseURL == "" { |
| 1076 | return |
| 1077 | } |
| 1078 | if u, err := url.Parse(s.baseURL); err == nil { |
| 1079 | switch u.Hostname() { |
| 1080 | case "", "0.0.0.0", "::": |
| 1081 | 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) |
| 1082 | } |
| 1083 | } |
| 1084 | } |
| 1085 | |
| 1086 | // specialUseTLDs is the (finite) set of reserved top-level names from the IANA |
| 1087 | // Special-Use Domain Names registry + related RFCs that never resolve to a |
no outgoing calls