fixed route gone after container restart / Brename

This commit is contained in:
yusing
2024-10-02 15:38:36 +08:00
parent a7a922308e
commit aa16287447
6 changed files with 43 additions and 21 deletions

View File

@@ -2,7 +2,6 @@ package middleware
import (
"net"
"net/http"
D "github.com/yusing/go-proxy/internal/docker"
E "github.com/yusing/go-proxy/internal/error"
@@ -52,11 +51,8 @@ var realIPOptsDefault = func() *realIPOpts {
func NewRealIP(opts OptionsRaw) (*Middleware, E.NestedError) {
riWithOpts := new(realIP)
riWithOpts.m = &Middleware{
impl: riWithOpts,
before: func(next http.HandlerFunc, w ResponseWriter, r *Request) {
riWithOpts.setRealIP(r)
next(w, r)
},
impl: riWithOpts,
before: Rewrite(riWithOpts.setRealIP),
}
riWithOpts.realIPOpts = realIPOptsDefault()
err := Deserialize(opts, riWithOpts.realIPOpts)