designcourse icon indicating copy to clipboard operation
designcourse copied to clipboard

sendBeacon calls blocked

Open ffissore opened this issue 2 years ago • 6 comments

We have a proxy and we configured datadogRum to use it with the proxyUrl configuration. uBlock intercepts the call before even reaching our proxy

Any suggestion?

ffissore avatar May 23 '22 14:05 ffissore

Although I don't know how much effective, one suggestion is the one provided in #1344: when proxyUrl is provided, send the ddforward value as part of the POST data, not as part of the URL

ffissore avatar May 23 '22 14:05 ffissore

After some investigation, it looks like the request is blocked because uBlock blocks requests sent via sendBeacon

ffissore avatar May 23 '22 14:05 ffissore

Hello @ffissore,

As you mentioned in your comments, the issue is indeed not related to proxy configuration. We are aware of the blocking of sendBeacon requests, it is related to the EasyPrivacy block list used by uBlock and other ad/tracker blockers, see https://github.com/uBlockOrigin/uAssets/issues/11272.

One way to circumvent the blocking could be to have your proxy on your web application domain, only third party calls are blocked.

We are also planning to rework our strategy to send requests in the short/mid term, it should less rely on sendBeacon which would then mitigate this behavior. We'll keep you posted here.

bcaudan avatar May 24 '22 09:05 bcaudan

Thx, I'll wait for the rework then

~~This is out of scope for this issue, but please, pretty please, consider packing the proxied request in a different way, to avoid hitting Cloudflare WAF as reported in #1344: alternatively, allow devs to inject a custom mechanism for sending requests~~ (@bcaudan moved discussion to #1344)

ffissore avatar May 24 '22 13:05 ffissore

One way to circumvent the blocking could be to have your proxy on your web application domain, only third party calls are blocked.

Ran into this issue today due to our application domains using a CNAME record to a third party DNS provider. So they're flagged as third party requests and due to the requests using sendBeacon dd's request to our proxy for rum are being blocked (Firefox only due to CNAME inspection uBlock does there).

derekaug avatar Jun 03 '22 22:06 derekaug

With 4.29.0 version, most of the requests are now using fetch instead of sendBeacon. We now only use sendBeacon to flush batched data when the page visibility becomes hidden or before unload.

It should then mitigate the impact of the blocking of sendBeacon requests.

bcaudan avatar Jan 03 '23 13:01 bcaudan