Skip to content

Commit

Permalink
Merge pull request #1228 from apernet/wip-masq-proxy-url-scheme
Browse files Browse the repository at this point in the history
fix: check the URL scheme of `masquerade.proxy.url` in server config
  • Loading branch information
tobyxdd authored Oct 19, 2024
2 parents b960bea + af2d75d commit 4567713
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,9 @@ func (c *serverConfig) fillMasqHandler(hyConfig *server.Config) error {
if err != nil {
return configError{Field: "masquerade.proxy.url", Err: err}
}
if u.Scheme != "http" && u.Scheme != "https" {
return configError{Field: "masquerade.proxy.url", Err: fmt.Errorf("unsupported protocol scheme \"%s\"", u.Scheme)}
}
handler = &httputil.ReverseProxy{
Rewrite: func(r *httputil.ProxyRequest) {
r.SetURL(u)
Expand Down

0 comments on commit 4567713

Please sign in to comment.