1
0
mirror of https://github.com/labstack/echo.git synced 2025-07-05 00:58:47 +02:00

Proper header and MIME constants

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2016-04-06 07:28:53 -07:00
parent adad28012c
commit 8b5772cf65
10 changed files with 92 additions and 93 deletions

View File

@ -90,9 +90,9 @@ func LoggerFromConfig(config LoggerConfig) echo.MiddlewareFunc {
return w.Write([]byte(time.Now().Format(time.RFC3339)))
case "remote_ip":
ra := rq.RemoteAddress()
if ip := rq.Header().Get(echo.XRealIP); ip != "" {
if ip := rq.Header().Get(echo.HeaderXRealIP); ip != "" {
ra = ip
} else if ip = rq.Header().Get(echo.XForwardedFor); ip != "" {
} else if ip = rq.Header().Get(echo.HeaderXForwardedFor); ip != "" {
ra = ip
} else {
ra, _, _ = net.SplitHostPort(ra)