Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 496 Bytes

README.md

File metadata and controls

26 lines (18 loc) · 496 Bytes

Gin's Real IP Middleware

Gin's Real IP middleware to set a http.Request's RemoteAddr to the results of parsing either the X-Forwarded-For header or the X-Real-IP header.

Usage

package main

import (
  "github.com/gin-gonic/gin"
  "github.com/thanhhh/gin-gonic-realip"
)

func main() {
  r := gin.New() // without any middlewares

  router.Use(realip.RealIP())

  r.Get("/", func() string {
    return "Hello world!"
  })

  r.Run(":8080")
}