Hisham Mubarak
Hisham Mubarak

Reputation: 1609

net::ERR_CONNECTION_CLOSED in Angular 2 Firebase App

I hosted my Node app and MongoDB on a DigitalOcean droplet and Angular App in Firebase. I am able to connect to Node backend from Postman and from my Angular App running locally on port 4200. But when I use my Angular App hosted in Firebase to connect to the Backend in DO Droplet, I get this error in Chrome console.

Error Message in console

I have added the link of Firebase app in CORS Whitelist Array in Node app, also added backend url in environment.prod.ts file as

backednUrl: 'https://***.**.**.***:3000'

The Error log doesn't say much in Specific. How do I fix this error? Is this because of any SSL or HTTPS issue?

Upvotes: 1

Views: 5664

Answers (1)

Lansana Camara
Lansana Camara

Reputation: 9873

These kind of error occurs when the remote server is not listening for requests.

For instance, if no connection is possible (the remote server is not listening for requests on a port, for example), you will get this error:

net::ERR_CONNECTION_REFUSED

In your case you got:

net::ERR_CONNECTION_CLOSED

This error usually has to do with SSL, and your SSL certificate specifically. You need to make sure you have a valid SSL certificate.

Upvotes: 2

Related Questions