I was using the @HostListner ('window:beforeunload') to call a http.get request to when the user was trying to refresh or close browser tab or window. @HostListener('window:beforeunload', ['$event']) handleBeforeUnload(event: Event) { console.log("chat session id ", this.sessionService.getSessionId()) if (this.sessionService.getSessionId() != null) { this.chatService.closeAgent(); this.sessionService.removeSessionId() } } closeAgent() { if((environment.genAIService === 'IG_GENAI_SERVICE')&&(this.sessionService.getSessionId()!=null)){ const chatSessionId = this.sessionService.getSessionId(); const url = `va/close-chat/${chatSessionId}`; this.http.get<boolean>(url).subscribe({ next: (response) => { console.log('API call successfully ',response); //this.tosterService.showInfo("Your session is closed") } }); } } This is working fine in my local with http but it was not working with https sometimes. Can someone please help me to fix this issue. Thanks Continue reading...