add: NEXT_PUBLIC_STOREFRONT_URL and NEXT_PUBLIC_HOMEPAGE_URL. Remove NEXT_PUBLIC_MARKETPLACE_URL.
Build & Deploy / Build & Push Docker Image (push) Failing after 1m5s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / Type Check (all packages) (push) Failing after 32s
Test / API Unit Tests (push) Has been skipped
Test / Homepage Unit Tests (push) Has been skipped
Test / Storefront Unit Tests (push) Has been skipped
Test / Admin Unit Tests (push) Has been skipped
Test / Dashboard Unit Tests (push) Has been skipped
Test / API Integration Tests (push) Has been skipped

This commit is contained in:
root
2026-06-27 23:52:34 -04:00
parent a486f891cf
commit abb3a18345
17 changed files with 79 additions and 74 deletions
+5 -5
View File
@@ -1,7 +1,7 @@
import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'
const MARKETPLACE_URL = process.env.NEXT_PUBLIC_MARKETPLACE_URL ?? 'http://localhost:3000'
const STOREFRONT_URL = process.env.NEXT_PUBLIC_STOREFRONT_URL ?? 'http://localhost:3000'
const DASHBOARD_BASE_PATH = '/dashboard'
function toDashboardAppPath(pathname: string): string {
@@ -32,7 +32,7 @@ function deduplicatePublicDashboardPath(pathname: string): string | null {
function resolveProxyUrl(req: NextRequest, pathname: string): URL {
const forwardedHost = req.headers.get('x-forwarded-host')
const forwardedProto = req.headers.get('x-forwarded-proto')
const marketplaceOrigin = new URL(MARKETPLACE_URL)
const storefrontOrigin = new URL(STOREFRONT_URL)
const url = new URL(pathname, req.nextUrl.origin)
if (forwardedHost && !isInternalHost(forwardedHost)) {
@@ -42,8 +42,8 @@ function resolveProxyUrl(req: NextRequest, pathname: string): URL {
url.host = req.nextUrl.host
url.protocol = req.nextUrl.protocol
} else {
url.host = marketplaceOrigin.host
url.protocol = marketplaceOrigin.protocol
url.host = storefrontOrigin.host
url.protocol = storefrontOrigin.protocol
}
return url
}
@@ -51,7 +51,7 @@ function resolveProxyUrl(req: NextRequest, pathname: string): URL {
function isInternalHost(host: string | null): boolean {
if (!host) return false
const hostname = host.split(':')[0]?.toLowerCase()
return ['host.docker.internal', 'dashboard', 'admin', 'api', 'marketplace'].includes(hostname)
return ['host.docker.internal', 'dashboard', 'admin', 'api', 'homepage', 'storefront'].includes(hostname)
}
function isProtectedRoute(req: NextRequest) {