Skip to content

Commit 0cd43fc

Browse files
committed
refactor: use native express methods for url construction
1 parent 0621325 commit 0cd43fc

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/pages/home-page.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const HomePage: NextPage<{
3030
);
3131
};
3232
export async function getServerSideProps({ query, locale, locales, req }) {
33-
const currentHref = `${req.headers['x-forwarded-proto'] || 'http'}://${req.headers.host}${req.url}`;
3433
locale = GetLocale(req, locale, locales);
3534
query = JSON.parse(query.props);
3635
return {
@@ -43,7 +42,7 @@ export async function getServerSideProps({ query, locale, locales, req }) {
4342
claims: JSON.parse(JSON.stringify(query.claims)),
4443
stats: JSON.parse(JSON.stringify(query.stats)),
4544
nameSpace: query.nameSpace ? query.nameSpace : NameSpaceEnum.Main,
46-
href: currentHref,
45+
href: req.protocol + "://" + req.get("host") + req.originalUrl,
4746
},
4847
};
4948
}

0 commit comments

Comments
 (0)