git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #431 from ploxiln/nil_upstream_url

gracefully report un-parsed upstream URL

commit23cef892365a2e5b16845a7e163f23f08e9a3994 authorJehiah Czebotar <jehiah@gmail.com> dateMon 28 Aug 2017, 20:46 (9 years ago) parent11bdcc93d8b59e
1 file changed+8−8
options.go+8−8
options.go+8−8
@@ -131,7 +131,8 @@ func (o *Options) Validate() error {
131131 msgs = append(msgs, "missing setting: client-secret")
132132 }
133133 if o.AuthenticatedEmailsFile == "" && len(o.EmailDomains) == 0 && o.HtpasswdFile == "" {
134− msgs = append(msgs, "missing setting for email validation: email-domain or authenticated-emails-file required.\n use email-domain=* to authorize all email addresses")
134+ msgs = append(msgs, "missing setting for email validation: email-domain or authenticated-emails-file required."+
135+ "\n use email-domain=* to authorize all email addresses")
135136 }
136137
137138 o.redirectURL, msgs = parseURL(o.RedirectURL, "redirect", msgs)
@@ -139,14 +140,13 @@ func (o *Options) Validate() error {
139140 for _, u := range o.Upstreams {
140141 upstreamURL, err := url.Parse(u)
141142 if err != nil {
142− msgs = append(msgs, fmt.Sprintf(
143− "error parsing upstream=%q %s",
144− upstreamURL, err))
145− }
146− if upstreamURL.Path == "" {
147− upstreamURL.Path = "/"
143+ msgs = append(msgs, fmt.Sprintf("error parsing upstream: %s", err))
144+ } else {
145+ if upstreamURL.Path == "" {
146+ upstreamURL.Path = "/"
147+ }
148+ o.proxyURLs = append(o.proxyURLs, upstreamURL)
148149 }
149− o.proxyURLs = append(o.proxyURLs, upstreamURL)
150150 }
151151
152152 for _, u := range o.SkipAuthRegex {