# Dubbele verzoeken in Chrome

**URL:** https://meta.discourse.org/t/duplicate-requests-in-chrome/182251
**Category:** Support
**Created:** [5 maart 2021 om 21:03 UTC](https://meta.discourse.org/t/duplicate-requests-in-chrome/182251 "2021-03-05T21:03:58Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ivikash](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivikash/32/212109_2.png) [@ivikash](https://meta.discourse.org/u/ivikash)
#### Post date: [5 maart 2021 om 21:03 UTC](https://meta.discourse.org/t/duplicate-requests-in-chrome/182251/1 "2021-03-05T21:03:58Z")

</div>

Hello Team,

Our team is handling discourse forums and its experiencing issues of duplicate requests on Chrome and not on Firefox or Safari. I suspect this issue to be related to service workers - workbox.

What does the setup look like?

1. We have a domain → [https://example.com](https://example.com)
2. scripts is hosted at a subpath → [https://example.com/assets/myScript.js](https://example.com/assets/myScript.js)
3. myScript makes a GET call to an external end point - [https://foobar.com/](https://foobar.com/)

Whats the issue?

1. When I visit the forums for the first time (or hard refresh), a single request is sent from the browser.
2. Upon second request, two requests are sent from the browser. One from the file which is served from the service worker and one from fetchWrapper.mjs - [workbox/packages/workbox-core/\_private/fetchWrapper.mjs at 194cdeb63d5abb21490f88f01f02f4bcf7e6d54b · GoogleChrome/workbox · GitHub](https://github.com/GoogleChrome/workbox/blob/194cdeb63d5abb21490f88f01f02f4bcf7e6d54b/packages/workbox-core/_private/fetchWrapper.mjs#L111)

Additional Information:  
[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/service-worker.js.erb#L18-L35](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/service-worker.js.erb#L18-L35) - This is the configuration responsible for creating service workers. It uses Network first strategy.

How can we fix this?  
Just like auth [https://github.com/discourse/discourse/blob/master/app/assets/javascripts/service-worker.js.erb#L10](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/service-worker.js.erb#L10) - we can expose /analytics/ as a route or make it configurable for users to pass an array of custom routes which is set to NetworkOnly. Our setup is on Docker and EC2, so this should be exposed there as well.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [5 maart 2021 om 22:54 UTC](https://meta.discourse.org/t/duplicate-requests-in-chrome/182251/2 "2021-03-05T22:54:32Z")

</div>

Are you sure both requests are hitting the actual network? The second is likely being used to respond to the first.

---

<div class="post-metadata">

### Author: ![ivikash](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivikash/32/212109_2.png) [@ivikash](https://meta.discourse.org/u/ivikash)
#### Post date: [5 maart 2021 om 22:56 UTC](https://meta.discourse.org/t/duplicate-requests-in-chrome/182251/3 "2021-03-05T22:56:17Z")

</div>

Yes. In out setup its happening to our analytics code and thus, analytics data is doubled.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [6 maart 2021 om 06:29 UTC](https://meta.discourse.org/t/duplicate-requests-in-chrome/182251/4 "2021-03-06T06:29:56Z")

</div>

Those are not duplicated requests but just a quirk of how Chrome Dev Tools display the service worker proxy.

Also you can check the application logs to see that the server don’t get duplicate requests for any routes, like `/latest.json`.

So this is not a bug on Discourse.

---

<div class="post-metadata">

### Author: ![ivikash](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivikash/32/212109_2.png) [@ivikash](https://meta.discourse.org/u/ivikash)
#### Post date: [22 maart 2021 om 17:10 UTC](https://meta.discourse.org/t/duplicate-requests-in-chrome/182251/5 "2021-03-22T17:10:22Z")

</div>

Thank-You so much team. Indeed this is a Chrome quirk. Chrome is displaying multiple requests while the data has deduped data.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [21 april 2021 om 17:10 UTC](https://meta.discourse.org/t/duplicate-requests-in-chrome/182251/6 "2021-04-21T17:10:57Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
