Skip to content

Commit

Permalink
Fix host header
Browse files Browse the repository at this point in the history
  • Loading branch information
vinnyjth committed Mar 28, 2024
1 parent 8115042 commit 608fd7a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions micro-service/src/app/[[...slug]]/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export async function generateMetadata({ params, searchParams }, parent) {

if (!id) return parent;

const route = headers().get('referer');
const route =
headers().get('host') || headers().get('x-forwarded-host') || headers().get('referer');

const churchSlug = getChurchSlug(route);

Expand Down Expand Up @@ -54,14 +55,14 @@ export async function generateMetadata({ params, searchParams }, parent) {
}

export default function Page(props) {
const headersList = headers();
console.log(JSON.stringify(Array.from(headersList.entries()), null, 2));
const url =
headers().get('host') || headers().get('x-forwarded-host') || headers().get('referer');
return (
<>
<Head>
<link rel="icon" type="image/x-icon" href="../../file.svg" />
</Head>
<ClientOnly {...props} url={headersList.get('referer')} />
<ClientOnly {...props} url={url} />
</>
);
}

0 comments on commit 608fd7a

Please sign in to comment.