added: ipv4 based per locals

In compliance with Google OAuth factor by providing real ipv4 bound from localost machine

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-30 19:25:38 +08:00
parent 85699876f7
commit 2e5fd10b38
+10
View File
@@ -19,6 +19,16 @@
***********************************************************************************************************************************************************************/ ***********************************************************************************************************************************************************************/
require('dotenv').config(); require('dotenv').config();
// Force IPv4-only outbound connections. Hosts that resolve AAAA records but
// have no working IPv6 route (e.g. to Google's OAuth endpoints) hit ENETUNREACH
// on the v6 attempt — and Node's dual-stack "Happy Eyeballs" connector
// (autoSelectFamily) throws AggregateError instead of falling back cleanly to
// the reachable IPv4 address. dns.setDefaultResultOrder alone does NOT fix
// this (the connector still races both families); autoSelectFamily has to be
// disabled outright. See [AUTH] googleCallback OIDC error: AxiosError [AggregateError].
require('net').setDefaultAutoSelectFamily(false);
require('dns').setDefaultResultOrder('ipv4first');
const express = require('express'); const express = require('express');
const cors = require('cors'); const cors = require('cors');
const cookieParser = require('cookie-parser'); const cookieParser = require('cookie-parser');