Deno LandDeno

Deploy Docs

Get client IP address

Deploy this example

Deno Deploy provides the IP address of the client to your script via a request header named x-forwarded-for.

addEventListener("fetch", (event) => {
  // Get the value of the header named `x-forwarded-for`.
  // The value can either be a IPv4 or IPv6 address.
  const ip = event.request.headers.get("x-forwarded-for");
  const response = new Response(`Your IP address is <b>${ip}</b>`, {
    headers: { "content-type": "text/html" },

Visit for a live demo.

Please file an issue in our feedback repository if you find any problem in Deploy service or documentation.