Skip to content

Commit 459ef13

Browse files
authored
Merge pull request #5047 from tdonohue/port_4961_to_8x
[Port dspace-8_x] Fix for issue #4960 PM2 cluster mode ECONNREFUSED errors
2 parents b4a25cc + 4fc39c0 commit 459ef13

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,11 +7,19 @@ import 'reflect-metadata';
77
*/
88
import '@angular/localize/init';
99

10+
import { setDefaultResultOrder } from 'node:dns';
11+
1012
import { bootstrapApplication } from '@angular/platform-browser';
1113

1214
import { AppComponent } from './app/app.component';
1315
import { serverAppConfig } from './modules/app/server-app.config';
1416

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

1725
export default bootstrap;

0 commit comments

Comments
 (0)