Angular automatically changes the http to https to load resource

Viewed 476

In my angular app, all the HTTP resources are automatically changed to https while fetching. I checked the server, and there are no automatic redirect settings configured to https.

The following are the errors I get in the console and the network tab.

core.js:3864 ERROR 
HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: "Unknown Error", url: "http://xxxxxx-env.eba-prmacaby.ap-south-1.elasticbeanstalk.com/all/hub/", ok: false, …}
error: ProgressEvent {isTrusted: true, lengthComputable: false, loaded: 0, total: 0, type: "error", …}
headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, headers: Map(0)}
message: "Http failure response for http://xxxxx-env.eba-prmacaby.ap-south-1.elasticbeanstalk.com/all/hub/: 0 Unknown Error"
name: "HttpErrorResponse"
ok: false
status: 0
statusText: "Unknown Error"
url: "http://xxxxxx-env.eba-prmacaby.ap-south-1.elasticbeanstalk.com/all/hub/"
__proto__: HttpResponseBase

enter image description here

enter image description here In the console it says HTTP but in the network tab, it says HTTPS.

Request Code

constructor(private http: HttpClient) { }
     
 getHub( ): Observable<Hub> {
       
        return this.http.get<Hub>("http://xxxxxxxx-env.eba-prmacaby.ap-south-1.elasticbeanstalk.com/all/hub" );
      }
1 Answers
getHub(): Observable<Hub> {  
  return this.http.get<Hub>("http://xxxxxxxx-env.eba-prmacaby.ap-south-1.elasticbeanstalk.com/all/hub" ).subscribe(test => console.log(test));
  }

Try it and show what are u expecting.

Related