diff --git a/services/bridge/main.go b/services/bridge/main.go index fd0126b2bf..fca9e70a71 100644 --- a/services/bridge/main.go +++ b/services/bridge/main.go @@ -231,7 +231,7 @@ func NewApp(config config.Config, migrateFlag bool, versionFlag bool, version st // Serve starts the server func (a *App) Serve() { - mux := supportHttp.NewAPIMux(false) + mux := supportHttp.NewAPIMux() // Middlewares headers := make(http.Header) diff --git a/services/compliance/main.go b/services/compliance/main.go index e2c4a9c399..0ea181a16e 100644 --- a/services/compliance/main.go +++ b/services/compliance/main.go @@ -170,7 +170,7 @@ func NewApp(config config.Config, migrateFlag bool, versionFlag bool, version st // Serve starts the server func (a *App) Serve() { // External endpoints - external := supportHttp.NewAPIMux(false) + external := supportHttp.NewAPIMux() // Middlewares headers := http.Header{} @@ -195,7 +195,7 @@ func (a *App) Serve() { }() // Internal endpoints - internal := supportHttp.NewAPIMux(false) + internal := supportHttp.NewAPIMux() internal.Use(supportHttp.StripTrailingSlashMiddleware("/admin")) internal.Use(supportHttp.HeadersMiddleware(headers, "/admin/")) diff --git a/services/federation/main.go b/services/federation/main.go index 75aecc215a..8f163d1e54 100644 --- a/services/federation/main.go +++ b/services/federation/main.go @@ -126,7 +126,7 @@ func initDriver(cfg Config) (federation.Driver, error) { } func initMux(driver federation.Driver) *chi.Mux { - mux := http.NewAPIMux(false) + mux := http.NewAPIMux() fed := &federation.Handler{ Driver: driver, diff --git a/services/friendbot/main.go b/services/friendbot/main.go index 0a7b092c60..07cbef527c 100644 --- a/services/friendbot/main.go +++ b/services/friendbot/main.go @@ -82,7 +82,7 @@ func run(cmd *cobra.Command, args []string) { } func initRouter(fb *internal.Bot) *chi.Mux { - mux := http.NewAPIMux(false) + mux := http.NewAPIMux() handler := &internal.FriendbotHandler{Friendbot: fb} mux.Get("/", handler.Handle) diff --git a/support/http/mux.go b/support/http/mux.go index 1578789841..d84eb013db 100644 --- a/support/http/mux.go +++ b/support/http/mux.go @@ -8,13 +8,9 @@ import ( // NewMux returns a new server mux configured with the common defaults used across all // stellar services. -func NewMux(behindProxy bool) *chi.Mux { +func NewMux() *chi.Mux { mux := chi.NewMux() - if behindProxy { - mux.Use(middleware.RealIP) - } - mux.Use(middleware.RequestID) mux.Use(middleware.Recoverer) mux.Use(LoggingMiddleware) @@ -24,8 +20,8 @@ func NewMux(behindProxy bool) *chi.Mux { // NewAPIMux returns a new server mux configured with the common defaults used for a web API in // stellar. -func NewAPIMux(behindProxy bool) *chi.Mux { - mux := NewMux(behindProxy) +func NewAPIMux() *chi.Mux { + mux := NewMux() c := cors.New(cors.Options{ AllowedOrigins: []string{"*"},