I'm using Angular 10 Service Worker to subscribe to push notifications. I'm calling this function after login:
subscribeToNotifications(): void {
this.swPush.requestSubscription({
serverPublicKey: environment.vapidPublicKey
})
.then(sub => this.deviceService.subscribeDevice(sub).subscribe())
.catch(err => console.error('Could not subscribe to notifications', err));
}
The function subscribeDevice() looks like this:
public subscribeDevice(sub): Observable<any> {
return this.http.post(`${this.API_URL}/devices/webpush/`, sub, this.options);
}
I'm serving with http-server like so:
http-server -p 4200 -c-1 dist/produccion-angular
However, when executing the function, a 504 gateway timeout comes out:
I checked my backend log and the request is not even being done so obviously it's not the server. I don't know what to do. I read the part in the angular documentation about bypassing the service worker and let the browser handle the request but then this happens:
Problem is being caused by the adblocker extension I have installed in Chrome.