diff --git a/lib/jmap/client.ts b/lib/jmap/client.ts index 7056dfa0..b94cdc70 100644 --- a/lib/jmap/client.ts +++ b/lib/jmap/client.ts @@ -250,7 +250,12 @@ export class JMAPClient implements IJMAPClient { this.startKeepAlive(); } catch (error) { - if (error instanceof TypeError && (error.message === 'Failed to fetch' || error.message.includes('NetworkError'))) { + if (error instanceof TypeError && ( + error.message === 'Failed to fetch' || + error.message.includes('NetworkError') || + error.message === 'Load failed' || + error.message === 'cancelled' + )) { let serverReachable = false; try { await fetch(sessionUrl, { mode: 'no-cors' }); diff --git a/lib/oauth/cookie-config.ts b/lib/oauth/cookie-config.ts index 51ee9a65..3ef4b9b4 100644 --- a/lib/oauth/cookie-config.ts +++ b/lib/oauth/cookie-config.ts @@ -3,7 +3,7 @@ const COOKIE_SAME_SITE = (process.env.COOKIE_SAME_SITE || 'lax') as 'lax' | 'non export function getCookieOptions() { return { httpOnly: true, - secure: COOKIE_SAME_SITE === 'none' ? true : process.env.NODE_ENV === 'production', + secure: COOKIE_SAME_SITE === 'none' || process.env.NODE_ENV === 'production', sameSite: COOKIE_SAME_SITE, path: '/', maxAge: 30 * 24 * 60 * 60, diff --git a/stores/auth-store.ts b/stores/auth-store.ts index f5f29939..fd0a29a8 100644 --- a/stores/auth-store.ts +++ b/stores/auth-store.ts @@ -51,7 +51,7 @@ interface AuthState { const ERROR_PATTERNS: Array<{ key: string; matches: string[] }> = [ { key: 'cors_blocked', matches: ['CORS_ERROR'] }, { key: 'invalid_credentials', matches: ['Invalid username or password', '401', 'Unauthorized'] }, - { key: 'connection_failed', matches: ['network', 'Failed to fetch', 'NetworkError', 'ECONNREFUSED'] }, + { key: 'connection_failed', matches: ['network', 'Failed to fetch', 'NetworkError', 'ECONNREFUSED', 'Load failed', 'cancelled'] }, { key: 'server_error', matches: ['500', '502', '503', '504', 'Internal Server Error', 'Service Unavailable'] }, ];