I'm encountering an SSL certificate issue with Angular SSR (Server-Side Rendering) when trying to access my .NET backend. The interesting part is that everything works perfectly fine on client-side rendering.
Environment
- Angular 18 (also tested with Angular 19 RC)
- .NET backend running on https://localhost:7205
- Certificate is added to root certificate store and shows as trusted in browser
What's Working
- Client-side requests work perfectly fine
- Certificate is recognized as trusted in browser
- Backend endpoints are accessible directly through browser
What's Not Working
During SSR, I get the following error when trying to make HTTP requests:
HTTP Error Intercepted: HttpErrorResponse {
status: 0,
statusText: 'Unknown Error',
url: 'https://localhost:7205/api/Account/MyInfo',
ok: false,
message: 'Http failure response for https://localhost:7205/api/Account/MyInfo: 0 Unknown Error'
}
I attempted to disable SSL verification on the server by adding this to server.ts:
Beside that, the file is the default.
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
However, this didn't resolve the issue.
Any guidance or suggestions would be greatly appreciated. Thank you!