Http request from safari goes to infinite pending state on iOS 18 after collapsing the browser

On my web page, there is an HTTP request that triggers a push notification in the authorization application and the request gets the response after getting confirmation from the app. It works fine when another device receives push notifications and handles confirmation. But if I use the same device, the request will remain pending after switching to the auth application.

I tried to use visibilitychange event to cancel the pending request and restart it. But the second one also gets stuck. Only if I add 1-2 seconds timeout after cancelation new request works fine. I assume it’s related to Background Network Suspension when Safari goes to the background. But is there any way to track the network state to handle this scenario properly?