melhorias de docker
This commit is contained in:
parent
31499a0c69
commit
67d4e86302
3 changed files with 80 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ package elinps
|
|||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
|
@ -39,6 +40,20 @@ func (p *PainelHandlers) Router() http.Handler {
|
|||
p.auth.handlerPainel(w, r, p.store)
|
||||
})
|
||||
|
||||
// Debug: conferir IP real / headers.
|
||||
// Protegido pelo mesmo middleware do painel.
|
||||
r.With(func(next http.Handler) http.Handler { return p.auth.middleware(next) }).Get("/debug/ip", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{
|
||||
"remote_addr": r.RemoteAddr,
|
||||
"x_forwarded_for": r.Header.Get("X-Forwarded-For"),
|
||||
"x_real_ip": r.Header.Get("X-Real-IP"),
|
||||
"x_forwarded_proto": r.Header.Get("X-Forwarded-Proto"),
|
||||
"x_forwarded_host": r.Header.Get("X-Forwarded-Host"),
|
||||
"user_agent": r.UserAgent(),
|
||||
})
|
||||
})
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue