Skip to content

Commit

Permalink
Merge pull request bitly#431 from ploxiln/nil_upstream_url
Browse files Browse the repository at this point in the history
gracefully report un-parsed upstream URL
  • Loading branch information
jehiah authored Aug 29, 2017
2 parents 11bdcc9 + 3d8b59e commit 23cef89
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,22 @@ func (o *Options) Validate() error {
msgs = append(msgs, "missing setting: client-secret")
}
if o.AuthenticatedEmailsFile == "" && len(o.EmailDomains) == 0 && o.HtpasswdFile == "" {
msgs = append(msgs, "missing setting for email validation: email-domain or authenticated-emails-file required.\n use email-domain=* to authorize all email addresses")
msgs = append(msgs, "missing setting for email validation: email-domain or authenticated-emails-file required."+
"\n use email-domain=* to authorize all email addresses")
}

o.redirectURL, msgs = parseURL(o.RedirectURL, "redirect", msgs)

for _, u := range o.Upstreams {
upstreamURL, err := url.Parse(u)
if err != nil {
msgs = append(msgs, fmt.Sprintf(
"error parsing upstream=%q %s",
upstreamURL, err))
}
if upstreamURL.Path == "" {
upstreamURL.Path = "/"
msgs = append(msgs, fmt.Sprintf("error parsing upstream: %s", err))
} else {
if upstreamURL.Path == "" {
upstreamURL.Path = "/"
}
o.proxyURLs = append(o.proxyURLs, upstreamURL)
}
o.proxyURLs = append(o.proxyURLs, upstreamURL)
}

for _, u := range o.SkipAuthRegex {
Expand Down

0 comments on commit 23cef89

Please sign in to comment.