feat(proxy): Add reverse proxy feature

This commit is contained in:
Björn Benouarets
2026-02-05 23:58:47 +01:00
parent 07474afae9
commit 30adf0c701
20 changed files with 514 additions and 323 deletions

27
app/middlewares/logger.go Normal file
View File

@@ -0,0 +1,27 @@
package middlewares
import (
"net/http"
"time"
"git.secnex.io/secnex/masterlog"
"github.com/go-chi/chi/v5/middleware"
)
func LoggerMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
ww := middleware.NewWrapResponseWriter(w, r.ProtoMajor)
next.ServeHTTP(ww, r)
masterlog.Info("HTTP Request", map[string]interface{}{
"method": r.Method,
"path": r.URL.Path,
"status": ww.Status(),
"duration": time.Since(start).String(),
"host": r.Host,
"ip": r.RemoteAddr,
})
})
}