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

How do I get the REAL-IP from wsAcceptor #444

Open
beebee518518 opened this issue Feb 24, 2025 · 3 comments
Open

How do I get the REAL-IP from wsAcceptor #444

beebee518518 opened this issue Feb 24, 2025 · 3 comments

Comments

@beebee518518
Copy link

My client connect to connector node thought Nginx proxy,

I use s.RemoteAddr() . IP addr is Nginx server's IP.

I want to get Real client IP or get request headers["X-REAL-IP"]

how do I do ?

thanks

@rsafonseca
Copy link
Collaborator

You can try enabling the use of proxy protocol both on nginx config and in the acceptor

@beebee518518
Copy link
Author

thanks.

@beebee518518
Copy link
Author

beebee518518 commented Feb 27, 2025

@rsafonseca
I checked the code in file acceptor/ws_acceptor.go. PROXY protocol support WsAcceptor not implemented

// PROXY protocol support not implemented for WS acceptor
func (w *WSAcceptor) EnableProxyProtocol() {
}

and I found file acceptor/proxyprotowrapper.go, it's checkPrefix() only for TCP, because it read header just from tcp buf, but websocket read header must from http headers.

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

No branches or pull requests

2 participants