Merge pull request #431 from ploxiln/nil_upstream_url
gracefully report un-parsed upstream URL
This commit is contained in:
commit
23cef89236
16
options.go
16
options.go
@ -131,7 +131,8 @@ func (o *Options) Validate() error {
|
|||||||
msgs = append(msgs, "missing setting: client-secret")
|
msgs = append(msgs, "missing setting: client-secret")
|
||||||
}
|
}
|
||||||
if o.AuthenticatedEmailsFile == "" && len(o.EmailDomains) == 0 && o.HtpasswdFile == "" {
|
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)
|
o.redirectURL, msgs = parseURL(o.RedirectURL, "redirect", msgs)
|
||||||
@ -139,14 +140,13 @@ func (o *Options) Validate() error {
|
|||||||
for _, u := range o.Upstreams {
|
for _, u := range o.Upstreams {
|
||||||
upstreamURL, err := url.Parse(u)
|
upstreamURL, err := url.Parse(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msgs = append(msgs, fmt.Sprintf(
|
msgs = append(msgs, fmt.Sprintf("error parsing upstream: %s", err))
|
||||||
"error parsing upstream=%q %s",
|
} else {
|
||||||
upstreamURL, err))
|
if upstreamURL.Path == "" {
|
||||||
|
upstreamURL.Path = "/"
|
||||||
|
}
|
||||||
|
o.proxyURLs = append(o.proxyURLs, upstreamURL)
|
||||||
}
|
}
|
||||||
if upstreamURL.Path == "" {
|
|
||||||
upstreamURL.Path = "/"
|
|
||||||
}
|
|
||||||
o.proxyURLs = append(o.proxyURLs, upstreamURL)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, u := range o.SkipAuthRegex {
|
for _, u := range o.SkipAuthRegex {
|
||||||
|
Loading…
Reference in New Issue
Block a user