diff --git a/internal/config/state.go b/internal/config/state.go index ab69b785..63712dae 100644 --- a/internal/config/state.go +++ b/internal/config/state.go @@ -196,7 +196,6 @@ func (state *state) initEntrypoint() error { matchDomains := state.MatchDomains state.entrypoint.SetFindRouteDomains(matchDomains) - state.entrypoint.SetCatchAllRules(epCfg.Rules.CatchAll) state.entrypoint.SetNotFoundRules(epCfg.Rules.NotFound) errs := gperr.NewBuilder("entrypoint error") diff --git a/internal/entrypoint/entrypoint.go b/internal/entrypoint/entrypoint.go index c1f2e658..6f2d7644 100644 --- a/internal/entrypoint/entrypoint.go +++ b/internal/entrypoint/entrypoint.go @@ -18,7 +18,6 @@ import ( type Entrypoint struct { middleware *middleware.Middleware - catchAllHandler http.Handler notFoundHandler http.Handler accessLogger *accesslog.AccessLogger findRouteFunc func(host string) types.HTTPRoute @@ -62,19 +61,7 @@ func (ep *Entrypoint) SetMiddlewares(mws []map[string]any) error { return nil } -func (ep *Entrypoint) SetCatchAllRules(rules rules.Rules) { - if len(rules) == 0 { - ep.catchAllHandler = nil - return - } - ep.catchAllHandler = rules.BuildHandler(http.HandlerFunc(ep.serveHTTP)) -} - func (ep *Entrypoint) SetNotFoundRules(rules rules.Rules) { - if len(rules) == 0 { - ep.notFoundHandler = nil - return - } ep.notFoundHandler = rules.BuildHandler(http.HandlerFunc(ep.serveNotFound)) } @@ -97,14 +84,6 @@ func (ep *Entrypoint) FindRoute(s string) types.HTTPRoute { } func (ep *Entrypoint) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if ep.catchAllHandler != nil { - ep.catchAllHandler.ServeHTTP(w, r) - return - } - ep.serveHTTP(w, r) -} - -func (ep *Entrypoint) serveHTTP(w http.ResponseWriter, r *http.Request) { if ep.accessLogger != nil { rec := accesslog.NewResponseRecorder(w) w = rec diff --git a/internal/entrypoint/types/config.go b/internal/entrypoint/types/config.go index 859a7cdb..eeca7518 100644 --- a/internal/entrypoint/types/config.go +++ b/internal/entrypoint/types/config.go @@ -8,7 +8,6 @@ import ( type Config struct { SupportProxyProtocol bool `json:"support_proxy_protocol"` Rules struct { - CatchAll rules.Rules `json:"catch_all"` NotFound rules.Rules `json:"not_found"` } `json:"rules"` Middlewares []map[string]any `json:"middlewares"`