Short summary (what's happening) I have a preview deployment that should be public on [REDACTED_CUSTOM_DOMAIN], but the domain always returns HTTP 401 with WWW-Authenticate: Basic realm="Protected". App-level Basic Auth and middleware challenges have been disabled for preview, but the 401 persists. The response appears to come from Vercel's edge (header server: Vercel).
Current: Visiting https://[REDACTED_CUSTOM_DOMAIN] returns HTTP/2 401 with header WWW-Authenticate: Basic realm="Protected". This happens for plain GET, requests with x-vercel-protection-bypass (header and query param), and requests that include a _vercel_jwt cookie set via an interactive browser flow. Expected: After removing app-level Basic Auth for preview and assigning the domain to the staging branch, requests to the custom domain should return the app (HTTP 200) or allow the bypass header/cookie to authenticate automated clients (LHCI, curl).
import { NextResponse } from 'next/server' import type { NextRequest } from 'next/server' export function middleware(req: NextRequest) { // Basic Auth enforcement removed for preview return NextResponse.next() } export const config = { matcher: ['/((?!_next/static|_next/image|favicon.ico).*)'] }
Preview host (internal): [REDACTED_PREVIEW_HOST] (READY) Custom domain: [REDACTED_CUSTOM_DOMAIN] (recently removed + re-added and assigned to the staging branch) Framework: Next.js 16 (webpack build in Vercel), rootDirectory: web/web App-level settings: DISABLE_BASIC_AUTH=true set for Preview; app middleware modified to bypass Basic Auth in preview. Bypass token: VERCEL_AUTOMATION_BYPASS_SECRET configured in project (value redacted)