Skip to content

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.

License

Notifications You must be signed in to change notification settings

thanhhh/gin-gonic-realip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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")
}

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages