Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty Context.ClientIP() when listening on unix socket #2718

Open
VinTarZ opened this issue May 12, 2021 · 1 comment · May be fixed by #3359
Open

Empty Context.ClientIP() when listening on unix socket #2718

VinTarZ opened this issue May 12, 2021 · 1 comment · May be fixed by #3359

Comments

@VinTarZ
Copy link

VinTarZ commented May 12, 2021

How to reproduce

package main

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

func main() {
	gin.Default().RunUnix("./example.sock")
}

Expectations

ClientIP() and should actually treat unix socket as trusted proxy and return the real client IP as specified in docs

Actual result

Empty string is returned due to Context.RemoteIP() failing with nil, false when dealing with non-ip network listener

Environment

@wgjtyu
Copy link

wgjtyu commented Mar 23, 2022

#2962 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants