aqua icon indicating copy to clipboard operation
aqua copied to clipboard

get user ip address

Open malaxmimdkm opened this issue 3 years ago • 2 comments

How to get user ip address

malaxmimdkm avatar Aug 19 '21 15:08 malaxmimdkm

If your server is not running behind a proxy, you can now use the following code since Aqua v1.3.0

app.get("/", req => {
  const remoteHostname = (req.conn?.remoteAddr as Deno.NetAddr)?.hostname;
  // ...
});

predetermined avatar Aug 28 '21 17:08 predetermined

It depends on your goal, but generally, I think getting a user IP address is not that helpful. Because it changes too often. It's better to generate a UUID for each machine using tools like FingerprintJS

huydhoang avatar Aug 28 '21 19:08 huydhoang