From 5650fb1f209f1761a82cb263b253d5c3e6ae81d3 Mon Sep 17 00:00:00 2001 From: Dave Long Date: Thu, 5 Jun 2025 12:15:10 +0100 Subject: [PATCH] Send host header to Decoupled Router. --- packages/next-drupal/src/next-drupal.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/next-drupal/src/next-drupal.ts b/packages/next-drupal/src/next-drupal.ts index 6bb205ae..4889bad6 100644 --- a/packages/next-drupal/src/next-drupal.ts +++ b/packages/next-drupal/src/next-drupal.ts @@ -3,6 +3,7 @@ import { stringify } from "qs" import { JsonApiErrors } from "./jsonapi-errors" import { DrupalMenuTree } from "./menu-tree" import { NextDrupalBase } from "./next-drupal-base" +import { headers } from 'next/headers' import type { BaseUrl, DrupalFile, @@ -927,8 +928,12 @@ export class NextDrupal extends NextDrupalBase { ...options, } + const headersList = await headers(); + const host = headersList.get('host')?.replace(/:\d+$/, '') || ''; + const endpoint = this.buildUrl("/router/translate-path", { path, + host, }).toString() this.debug(`Fetching translated path, ${path}.`)