fix: try to fix middleware rewrite proto
This commit is contained in:
parent
bc906ccb56
commit
50c7caf3bb
|
|
@ -19,8 +19,9 @@ data:
|
|||
dns cloudflare {env.CF_API_TOKEN}
|
||||
}
|
||||
|
||||
reverse_proxy xlog-internal.crossbell.svc:3000 {
|
||||
reverse_proxy http://xlog-internal.crossbell.svc:3000 {
|
||||
header_up X-Forwarded-Host {host}
|
||||
header_up X-Forwarded-Proto http
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -33,8 +34,9 @@ data:
|
|||
on_demand
|
||||
}
|
||||
|
||||
reverse_proxy xlog-internal.crossbell.svc:3000 {
|
||||
reverse_proxy http://xlog-internal.crossbell.svc:3000 {
|
||||
header_up X-Forwarded-Host {host}
|
||||
header_up X-Forwarded-Proto http
|
||||
}
|
||||
}
|
||||
---
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@ data:
|
|||
dns cloudflare {env.CF_API_TOKEN}
|
||||
}
|
||||
|
||||
reverse_proxy xlog-internal.crossbell.svc:3000 {
|
||||
reverse_proxy http://xlog-internal.crossbell.svc:3000 {
|
||||
header_up X-Forwarded-Host {host}
|
||||
header_up X-Forwarded-Proto http
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -33,8 +34,9 @@ data:
|
|||
on_demand
|
||||
}
|
||||
|
||||
reverse_proxy xlog-internal.crossbell.svc:3000 {
|
||||
reverse_proxy http://xlog-internal.crossbell.svc:3000 {
|
||||
header_up X-Forwarded-Host {host}
|
||||
header_up X-Forwarded-Proto http
|
||||
}
|
||||
}
|
||||
---
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ export default async function middleware(req: NextRequest) {
|
|||
return NextResponse.redirect(`https://${req.headers.get("host")}/feed`, 301)
|
||||
}
|
||||
|
||||
console.debug(`${req.method} ${req.headers.get("host")}${pathname}`)
|
||||
console.debug(
|
||||
`${req.method} ${req.headers.get("host")}${pathname}, ${req.url}`,
|
||||
)
|
||||
|
||||
if (
|
||||
pathname.startsWith("/api/") ||
|
||||
|
|
@ -95,7 +97,7 @@ export default async function middleware(req: NextRequest) {
|
|||
return NextResponse.rewrite(
|
||||
new URL(
|
||||
`/site/${tenant?.subdomain}${pathname}${req.nextUrl.search}`,
|
||||
req.url.replace("https://", "http://"),
|
||||
req.url,
|
||||
),
|
||||
{
|
||||
request: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue