summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/curvy-pumpkins-remain.md5
-rw-r--r--packages/astro/src/core/app/node.ts7
2 files changed, 9 insertions, 3 deletions
diff --git a/.changeset/curvy-pumpkins-remain.md b/.changeset/curvy-pumpkins-remain.md
new file mode 100644
index 000000000..78849bb4f
--- /dev/null
+++ b/.changeset/curvy-pumpkins-remain.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Node adapter fallbacks to `:authority` http2 pseudo-header when `host` is nullish.
diff --git a/packages/astro/src/core/app/node.ts b/packages/astro/src/core/app/node.ts
index 97d7b71d1..7097db967 100644
--- a/packages/astro/src/core/app/node.ts
+++ b/packages/astro/src/core/app/node.ts
@@ -14,11 +14,12 @@ function createRequestFromNodeRequest(req: NodeIncomingMessage, body?: Uint8Arra
req.socket instanceof TLSSocket || req.headers['x-forwarded-proto'] === 'https'
? 'https'
: 'http';
- let url = `${protocol}://${req.headers.host}${req.url}`;
- let rawHeaders = req.headers as Record<string, any>;
+ const hostname = req.headers.host || req.headers[':authority'];
+ const url = `${protocol}://${hostname}${req.url}`;
+ const rawHeaders = req.headers as Record<string, any>;
const entries = Object.entries(rawHeaders);
const method = req.method || 'GET';
- let request = new Request(url, {
+ const request = new Request(url, {
method,
headers: new Headers(entries),
body: ['HEAD', 'GET'].includes(method) ? null : body,