Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix passthrough option #375

Merged
merged 3 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func ParseOptions() (*Options, error) {
flagSet.IntVar(&options.CertCacheSize, "cert-cache-size", 256, "Number of certificates to cache"),
flagSet.StringSliceVarP(&options.Allow, "allow", "a", nil, "Allowed list of IP/CIDR's to be proxied", goflags.FileNormalizedStringSliceOptions),
flagSet.StringSliceVarP(&options.Deny, "deny", "d", nil, "Denied list of IP/CIDR's to be proxied", goflags.FileNormalizedStringSliceOptions),
flagSet.StringSliceVarP(&options.PassThrough, "passthrough", "pt", nil, "List of passthrough domains", goflags.NormalizedStringSliceOptions),
flagSet.StringSliceVarP(&options.PassThrough, "passthrough", "pt", nil, "List of passthrough domains", goflags.FileNormalizedStringSliceOptions),
)

silent, verbose, veryVerbose := false, false, false
Expand Down
7 changes: 2 additions & 5 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,8 @@ func (p *Proxy) Run() error {
// http proxy
if p.httpProxy != nil {
p.httpProxy.TLSPassthroughFunc = func(req *http.Request) bool {
// if !stringsutil.ContainsAny(req.URL.Host, "avatars") {
// log.Printf("Skipped MITM for %v", req.URL.Host)
// return true
// }
return false
// Skip MITM for hosts that are in pass-through list
return util.MatchAnyRegex(p.options.PassThrough, req.Host)
}

p.httpProxy.SetRequestModifier(p)
Expand Down
Loading