options: gracefully report un-parsed upstream URL
upstreamURL is a nil pointer if there is an error parsing --upstream
This commit is contained in:
parent
3c51c914ac
commit
e9bbecface
13
options.go
13
options.go
@ -142,14 +142,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