feat: use x-forwarded-host
This commit is contained in:
parent
f4512803d8
commit
9d156cc520
|
|
@ -20,7 +20,6 @@ data:
|
|||
}
|
||||
|
||||
reverse_proxy xlog-internal.crossbell.svc:3000 {
|
||||
header_up host {host}
|
||||
header_up x-forwarded-proto http
|
||||
}
|
||||
}
|
||||
|
|
@ -35,7 +34,6 @@ data:
|
|||
}
|
||||
|
||||
reverse_proxy xlog-internal.crossbell.svc:3000 {
|
||||
header_up host {host}
|
||||
header_up x-forwarded-proto http
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,10 @@ export default async function middleware(req: NextRequest) {
|
|||
pathname === "/atom.xml" ||
|
||||
pathname === "/feed/xml"
|
||||
) {
|
||||
return NextResponse.redirect(`https://${req.headers.get("host")}/feed`, 301)
|
||||
return NextResponse.redirect(
|
||||
`https://${req.headers.get("x-forwarded-host")}/feed`,
|
||||
301,
|
||||
)
|
||||
}
|
||||
|
||||
console.debug(`${req.method} ${req.nextUrl}`)
|
||||
|
|
@ -72,7 +75,10 @@ export default async function middleware(req: NextRequest) {
|
|||
try {
|
||||
tenant = await (
|
||||
await fetch(
|
||||
new URL(`/api/host2handle?host=${req.headers.get("host")}`, req.url),
|
||||
new URL(
|
||||
`/api/host2handle?host=${req.headers.get("x-forwarded-host")}`,
|
||||
req.url,
|
||||
),
|
||||
)
|
||||
).json()
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue