diff --git a/.changeset/lemon-steaks-care.md b/.changeset/lemon-steaks-care.md new file mode 100644 index 000000000000..848db8fcd845 --- /dev/null +++ b/.changeset/lemon-steaks-care.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vercel': patch +--- + +Add back support for Astro.clientAddress diff --git a/examples/basics/public/favicon.svg b/examples/basics/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/basics/public/favicon.svg +++ b/examples/basics/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/blog/public/favicon.svg b/examples/blog/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/blog/public/favicon.svg +++ b/examples/blog/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/deno/public/favicon.ico b/examples/deno/public/favicon.ico deleted file mode 100644 index 578ad458b890..000000000000 Binary files a/examples/deno/public/favicon.ico and /dev/null differ diff --git a/examples/deno/public/favicon.svg b/examples/deno/public/favicon.svg new file mode 100644 index 000000000000..f157bd1c5e28 --- /dev/null +++ b/examples/deno/public/favicon.svg @@ -0,0 +1,9 @@ + + + + diff --git a/examples/deno/src/components/Layout.astro b/examples/deno/src/components/Layout.astro index fc09951543a9..60a7e6d87126 100644 --- a/examples/deno/src/components/Layout.astro +++ b/examples/deno/src/components/Layout.astro @@ -11,7 +11,7 @@ const { title } = Astro.props as Props; - + {title} diff --git a/examples/docs/public/favicon.svg b/examples/docs/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/docs/public/favicon.svg +++ b/examples/docs/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/framework-alpine/public/favicon.svg b/examples/framework-alpine/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/framework-alpine/public/favicon.svg +++ b/examples/framework-alpine/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/framework-lit/public/favicon.svg b/examples/framework-lit/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/framework-lit/public/favicon.svg +++ b/examples/framework-lit/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/framework-multiple/public/favicon.svg b/examples/framework-multiple/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/framework-multiple/public/favicon.svg +++ b/examples/framework-multiple/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/framework-preact/public/favicon.svg b/examples/framework-preact/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/framework-preact/public/favicon.svg +++ b/examples/framework-preact/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/framework-react/public/favicon.svg b/examples/framework-react/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/framework-react/public/favicon.svg +++ b/examples/framework-react/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/framework-solid/public/favicon.svg b/examples/framework-solid/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/framework-solid/public/favicon.svg +++ b/examples/framework-solid/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/framework-svelte/public/favicon.svg b/examples/framework-svelte/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/framework-svelte/public/favicon.svg +++ b/examples/framework-svelte/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/framework-vue/public/favicon.svg b/examples/framework-vue/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/framework-vue/public/favicon.svg +++ b/examples/framework-vue/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/hackernews/public/favicon.svg b/examples/hackernews/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/hackernews/public/favicon.svg +++ b/examples/hackernews/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/minimal/public/favicon.svg b/examples/minimal/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/minimal/public/favicon.svg +++ b/examples/minimal/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/non-html-pages/public/favicon.svg b/examples/non-html-pages/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/non-html-pages/public/favicon.svg +++ b/examples/non-html-pages/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/portfolio/public/favicon.svg b/examples/portfolio/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/portfolio/public/favicon.svg +++ b/examples/portfolio/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/ssr/public/favicon.svg b/examples/ssr/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/ssr/public/favicon.svg +++ b/examples/ssr/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/with-markdoc/public/favicon.svg b/examples/with-markdoc/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/with-markdoc/public/favicon.svg +++ b/examples/with-markdoc/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/with-markdown-plugins/public/favicon.svg b/examples/with-markdown-plugins/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/with-markdown-plugins/public/favicon.svg +++ b/examples/with-markdown-plugins/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/with-markdown-shiki/public/favicon.svg b/examples/with-markdown-shiki/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/with-markdown-shiki/public/favicon.svg +++ b/examples/with-markdown-shiki/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/with-mdx/public/favicon.svg b/examples/with-mdx/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/with-mdx/public/favicon.svg +++ b/examples/with-mdx/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/with-nanostores/public/favicon.svg b/examples/with-nanostores/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/with-nanostores/public/favicon.svg +++ b/examples/with-nanostores/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/with-tailwindcss/public/favicon.svg b/examples/with-tailwindcss/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/with-tailwindcss/public/favicon.svg +++ b/examples/with-tailwindcss/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/with-vite-plugin-pwa/public/favicon.svg b/examples/with-vite-plugin-pwa/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/with-vite-plugin-pwa/public/favicon.svg +++ b/examples/with-vite-plugin-pwa/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/examples/with-vitest/public/favicon.svg b/examples/with-vitest/public/favicon.svg index 0f3906297879..f157bd1c5e28 100644 --- a/examples/with-vitest/public/favicon.svg +++ b/examples/with-vitest/public/favicon.svg @@ -1,13 +1,9 @@ - - - - - - - - - - + + + diff --git a/packages/integrations/sitemap/README.md b/packages/integrations/sitemap/README.md index f4949ca51614..99e730997403 100644 --- a/packages/integrations/sitemap/README.md +++ b/packages/integrations/sitemap/README.md @@ -91,7 +91,7 @@ After verifying that the sitemaps are built, you can add them to your site's ` ``` -```txt ins={4} title="public/robots.txt" +```yaml ins={4} title="public/robots.txt" User-agent: * Allow: / diff --git a/packages/integrations/vercel/src/serverless/request-transform.ts b/packages/integrations/vercel/src/serverless/request-transform.ts index 6a86ad976571..819b8e8fecf6 100644 --- a/packages/integrations/vercel/src/serverless/request-transform.ts +++ b/packages/integrations/vercel/src/serverless/request-transform.ts @@ -2,6 +2,8 @@ import type { App } from 'astro/app'; import type { IncomingMessage, ServerResponse } from 'node:http'; import { splitCookiesString } from 'set-cookie-parser'; +const clientAddressSymbol = Symbol.for('astro.clientAddress'); + /* Credits to the SvelteKit team https://github.com/sveltejs/kit/blob/8d1ba04825a540324bc003e85f36559a594aadc2/packages/kit/src/exports/node/index.js @@ -99,13 +101,16 @@ export async function getRequest( req: IncomingMessage, bodySizeLimit?: number ): Promise { - return new Request(base + req.url, { + let headers = req.headers as Record; + let request = new Request(base + req.url, { // @ts-expect-error duplex: 'half', method: req.method, - headers: req.headers as Record, + headers, body: get_raw_body(req, bodySizeLimit), }); + Reflect.set(request, clientAddressSymbol, headers['x-forwarded-for']); + return request; } export async function setResponse(