Astro.clientAddress

Astro.clientAddress is the IP address of the current request's client.

Since Astro 1.0 Spec ↗

Syntax

const ip = Astro.clientAddress

Returns

string — The client's IP address as a string.

Examples

---
const ip = Astro.clientAddress;
---
<p>Your IP is {ip}</p>
Output
Renders the visitor's IP address resolved by the SSR adapter.

Notes

Only available in on-demand (SSR) rendered routes; accessing it in a static page throws. The value depends on the deployment adapter correctly forwarding the client IP (e.g. via X-Forwarded-For).

See also