You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I need to get the client ip address before the websocket connection and i have this:
const app = uWS
.SSLApp({ key_file_name: './privkey1.pem', cert_file_name: './cert1.pem' })
.ws('/*', require('./socket/connect'))
.any('/*', (res,req){
res.cork(() => {
res.write('<html><h1>');
res.write('Your proxied IP is: ' + Buffer.from(res.getProxiedRemoteAddressAsText()).toString());
res.write('</h1><h1>');
res.write('Your IP as seen by the origin server is: ' + Buffer.from(res.getRemoteAddressAsText()).toString());
res.end('</h1></html>');
});
})
.listen(443, (token) => {
if (token) {
console.log('Listening to port 443');
} else {
console.log('Failed to listen to port 443');
}
});
but I'm getting:
Your proxied IP is:
Your IP as seen by the origin server is: 0000:0000:0000:0000:0000:ffff:bc1b:f640
This seems my ipv6 address but if i check on https://www.whatismyip.com/ i get
My Public IPv4 is: 188.27.111.21
My Public IPv6 is: Not Detected
Is is safe to use this address to identify connections coming from the same IP?
Is there a way to get the ipv4 address?
Thanks
The text was updated successfully, but these errors were encountered:
You dont need the getProxiedRemoteAddress unless you have a reverse proxy set up, see here. The 0000:0000:0000:0000:0000:ffff:bc1b:f640 is the ip6 format which converts to/is the same thing as your ip4 188.27.111.21. All ip4 can convert to ip6 but not all ip6 can convert to ip4. So you should probably leave it in ip6 format, but you can convert to ip4 if needed https://stackoverflow.com/q/2786632
Hi,
I need to get the client ip address before the websocket connection and i have this:
but I'm getting:
This seems my ipv6 address but if i check on
https://www.whatismyip.com/
i getIs is safe to use this address to identify connections coming from the same IP?
Is there a way to get the ipv4 address?
Thanks
The text was updated successfully, but these errors were encountered: