This commit is contained in:
NotII
2025-04-06 16:20:01 +01:00
parent bff930be05
commit d05d7b4938
2 changed files with 4 additions and 11 deletions

View File

@@ -26,15 +26,8 @@ export async function middleware(req: NextRequest) {
}
try {
// Get the origin but handle localhost differently to avoid SSL issues
const origin = req.nextUrl.origin;
// Construct the auth check URL based on environment
// For localhost, explicitly use HTTP instead of HTTPS
const isLocalhost = origin.includes('localhost') || origin.includes('127.0.0.1');
const protocol = isLocalhost ? 'http' : 'https';
const host = req.nextUrl.host;
const authCheckUrl = `${protocol}://${host}/api/auth/check`;
// Always use localhost for internal container communication
const authCheckUrl = "http://localhost:3000/api/auth/check";
console.log(`Using internal auth check URL: ${authCheckUrl}`);