feat: support mutate all proxy requests
@@ -597,10 +597,6 @@ func (proxy *Proxy) checkWhiteList(r *http.Request) bool {
// also changes the scheme of the given request if the matched rule has
// UseHTTPS = true
func (proxy *Proxy) shouldUseDragonfly(req *http.Request) bool {
- if req.Method != http.MethodGet {
- return false
- }
-
for _, rule := range proxy.rules.Load().([]*config.ProxyRule) {
if rule.Match(req.URL.String()) {
if rule.UseHTTPS {
@@ -619,6 +615,10 @@ func (proxy *Proxy) shouldUseDragonfly(req *http.Request) bool {
req.URL.Host = rule.Redirect
req.Host = rule.Redirect
}
+
+ if req.Method != http.MethodGet {
+ return false
+ }
return !rule.Direct
}
}
