Skip to content

Commit 39052b5

Browse files
authored
Merge pull request #4961 from bram-atmire/fix/pm2-cluster-ipv6
Fix for issue #4960 PM2 cluster mode ECONNREFUSED errors
2 parents 2a0c78f + 126a0a0 commit 39052b5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main.server.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import 'reflect-metadata';
77
*/
88
import '@angular/localize/init';
99

10+
import { setDefaultResultOrder } from 'node:dns';
11+
1012
import {
1113
bootstrapApplication,
1214
BootstrapContext,
@@ -15,6 +17,12 @@ import {
1517
import { AppComponent } from './app/app.component';
1618
import { serverAppConfig } from './modules/app/server-app.config';
1719

20+
// Apply DNS resolution order fix for Node.js 17+ by preferring IPv4 over IPv6.
21+
// This fixes "ECONNREFUSED ::1:8080" errors in PM2 cluster mode when
22+
// the backend only listens on IPv4
23+
// See https://github.com/DSpace/dspace-angular/issues/4960
24+
setDefaultResultOrder('ipv4first');
25+
1826
const bootstrap = (context: BootstrapContext) => bootstrapApplication(AppComponent, serverAppConfig, context);
1927

2028
export default bootstrap;

0 commit comments

Comments
 (0)