From ab251109e20ed9432a0b8ed1ffba621fb7ac25b6 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Tue, 19 Jul 2022 11:16:16 -0400 Subject: [PATCH 1/2] Add docs on Astro.clientAddress --- src/pages/en/reference/api-reference.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pages/en/reference/api-reference.md b/src/pages/en/reference/api-reference.md index e2b7c0f844e0c..990f374c4b549 100644 --- a/src/pages/en/reference/api-reference.md +++ b/src/pages/en/reference/api-reference.md @@ -135,6 +135,18 @@ const path = Astro.canonicalURL.pathname;

Welcome to {path}

``` +### `Astro.clientAddress` + +Specifies the [IP address](https://en.wikipedia.org/wiki/IP_address) of the request. This property is only available when building for SSR (server-side rendering) and should not be used for static sites. + +```astro +--- +const ip = Astro.clientAddress; +--- + +
Your IP address is: { ip }
+``` + ### `Astro.site` `Astro.site` returns a `URL` made from `site` in your Astro config. If undefined, this will return a URL generated from `localhost`. From 4e46ecb6364481ce10453faff19b3c70f505eab5 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Wed, 20 Jul 2022 08:21:49 -0400 Subject: [PATCH 2/2] Add the Since tag for Astro.clientAddress --- src/pages/en/reference/api-reference.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/en/reference/api-reference.md b/src/pages/en/reference/api-reference.md index 990f374c4b549..3046af6f5c15f 100644 --- a/src/pages/en/reference/api-reference.md +++ b/src/pages/en/reference/api-reference.md @@ -1,4 +1,5 @@ --- +setup: import Since from '~/components/Since.astro'; layout: ~/layouts/MainLayout.astro title: API Reference i18nReady: true @@ -137,6 +138,8 @@ const path = Astro.canonicalURL.pathname; ### `Astro.clientAddress` + + Specifies the [IP address](https://en.wikipedia.org/wiki/IP_address) of the request. This property is only available when building for SSR (server-side rendering) and should not be used for static sites. ```astro