Skip to content

Commit d6b6526

Browse files
authored
Use proper host for pageinfo fetch (#54691)
1 parent c0e2c0a commit d6b6526

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/article-api/middleware/article.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import contextualize from '#src/frame/middleware/context/context.js'
1313
// for now, we're just querying pageinfo, we'll likely replace /api/pageinfo
1414
// with /api/meta and move or reference that code here
1515
async function getArticleMetadata(req: ExtendedRequestWithPageInfo) {
16+
const host = req.get('x-host') || req.get('x-forwarded-host') || req.get('host')
1617
const queryString = new URLSearchParams(req.query as Record<string, string>).toString()
17-
const apiUrl = `${req.protocol}://${req.get('host')}/api/pageinfo${queryString ? `?${queryString}` : ''}`
18+
const apiUrl = `${req.protocol}://${host}/api/pageinfo${queryString ? `?${queryString}` : ''}`
1819

1920
// Fetch the data from the pageinfo API
2021
const response = await fetch(apiUrl)

0 commit comments

Comments
 (0)