diff --git a/deploy/dev/cm.yaml b/deploy/dev/cm.yaml index f4301919..5dd1960a 100644 --- a/deploy/dev/cm.yaml +++ b/deploy/dev/cm.yaml @@ -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 } } --- diff --git a/deploy/prod/cm.yaml b/deploy/prod/cm.yaml index 9d4f2a77..992d4b40 100644 --- a/deploy/prod/cm.yaml +++ b/deploy/prod/cm.yaml @@ -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 } } --- diff --git a/src/middleware.ts b/src/middleware.ts index c58864d8..9083ea34 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -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: {