feat: use x-forwarded-host
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
+8
-2
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user