Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import 'reflect-metadata';
*/
import '@angular/localize/init';

import { setDefaultResultOrder } from 'node:dns';

import {
bootstrapApplication,
BootstrapContext,
Expand All @@ -15,6 +17,12 @@ import {
import { AppComponent } from './app/app.component';
import { serverAppConfig } from './modules/app/server-app.config';

// Apply DNS resolution order fix for Node.js 17+ by preferring IPv4 over IPv6.
// This fixes "ECONNREFUSED ::1:8080" errors in PM2 cluster mode when
// the backend only listens on IPv4
// See https://github.com/DSpace/dspace-angular/issues/4960
setDefaultResultOrder('ipv4first');

const bootstrap = (context: BootstrapContext) => bootstrapApplication(AppComponent, serverAppConfig, context);

export default bootstrap;
Loading