# Firefox experiences Network Protocol Violation on Discourse based Websites

**URL:** https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308
**Category:** Support
**Created:** [September 16, 2018, 9:23pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308 "2018-09-16T21:23:30Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![GregoriusTech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gregoriustech/32/111217_2.png) [@GregoriusTech](https://meta.discourse.org/u/GregoriusTech)
#### Post date: [September 16, 2018, 9:23pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/1 "2018-09-16T21:23:30Z")

</div>

So I have my own Discourse based Forums, and I got a weird Issue that I was conveniently able to reproduce while making an Account over here too. To me personally it happened on Kubuntu LTS 18.04 with the latest Release of Firefox being installed (probably happened the Versions before that too, I only recently switched to Linux and Firefox), and someone else also complained it happened to him on Mint. It also happens to some Users on Windows 10 according to @OvermindDL1 who would be better qualified at explaining all this, and now he gets pinged for not wanting to tell it himself. 😛

The Issue itself is that Firefox throws Errors either while logging in using oauth or when already being logged in with a session. It doesn’t happen when you are not logged in or attempt to log in, in some way shape or form.

I took Screenshots of it, while it happened during the Registration of this very Account I am writing this on.

 ![Screenshot_20180916_225440](https://global.discourse-cdn.com/meta/original/3X/9/5/955f2556bf42426418f7825550699306fe861dd2.png)

It happens every single time I open a fresh Tab of any Discourse based Site in Firefox that I am logged into, then I need to F5 or hit “try again” and it works again just fine (well until I close the tab and need to open it later again ofcourse).

I could middleclick the bookmark to open the Forums on new tabs and all the tabs created through this will consistently throw that Error and prompt me to try again.

Funnily enough this even happens when the Internet is fully disconnected. Instead of “Failed to Reach Website” I get “Network Protocol Violation”, meaning the Cache is involved in this aswell.

Needless to say this is a very infuriating Issue.

---

<div class="post-metadata">

### Author: ![GregoriusTech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gregoriustech/32/111217_2.png) [@GregoriusTech](https://meta.discourse.org/u/GregoriusTech)
#### Post date: [September 16, 2018, 9:24pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/2 "2018-09-16T21:24:43Z")

</div>

![Screenshot_20180916_225519](https://global.discourse-cdn.com/meta/original/3X/5/3/5314c099f6a5f6870fcd32a5855e2780ee671a9b.png)

Because I am new and it wont let me post the second Screenshot otherwise. And no I am too lazy to edit 2 Screenshots together into 1. 😜

---

<div class="post-metadata">

### Author: ![OvermindDL1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overminddl1/32/115252_2.png) [@OvermindDL1](https://meta.discourse.org/u/OvermindDL1)
#### Post date: [September 16, 2018, 9:30pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/3 "2018-09-16T21:30:30Z")

</div>

What I know about it is that when those errors appear then there is no request sent to the server, it seems constrained to the service worker itself without ever sending a request. It happens on all discourse sites. It doesn’t happen to my firefox at home on linux (that I’ve seen, but I don’t use it terribly often there), but it happens in firefox at work on win10, and it happens to basically everyone I ask fairly randomly.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 16, 2018, 9:35pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/4 "2018-09-16T21:35:27Z")

</div>

Does not happen to me at all and I have been using Firefox on windows exclusively for the last week

Something about you config at work is off

---

<div class="post-metadata">

### Author: ![GregoriusTech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gregoriustech/32/111217_2.png) [@GregoriusTech](https://meta.discourse.org/u/GregoriusTech)
#### Post date: [September 16, 2018, 9:44pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/5 "2018-09-16T21:44:10Z")

</div>

It happens to me on my personal Machine too, and it happened ever since I moved from Windows+Chrome to Kubuntu+Firefox last month, and that install of Kubuntu was fresh.

Some Machines have the Issue, some don’t. All I know what I posted here. 😉

Maybe its even just some security Setting in Firefox causing it.

And I tried without any Firefox Plugins/Extensions, and it still happens.

With all the unreliable Google Search that I have put into this, it is likely that there was some redirect stored in the cache and Firefox for security reasons while loading the site from cache said nope someone wants to hack this. But take this with a grain of salt, because its highly speculative.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 16, 2018, 9:48pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/6 "2018-09-16T21:48:30Z")

</div>

I don’t doubt this is happening, but I do not think this is a bug with Discourse.

Mozilla run a public Discourse @LeoMcA has anyone reported something like this to the Firefox bug tracker?

---

<div class="post-metadata">

### Author: ![GregoriusTech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gregoriustech/32/111217_2.png) [@GregoriusTech](https://meta.discourse.org/u/GregoriusTech)
#### Post date: [September 16, 2018, 9:53pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/7 "2018-09-16T21:53:30Z")

</div>

I got a screenshot of the Firefox console with the actual error.

 ![Screenshot_20180916_235218](https://global.discourse-cdn.com/meta/original/3X/b/f/bff3bc0f3901805775f53f47c1433f80db609cab.png)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 16, 2018, 9:55pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/8 "2018-09-16T21:55:45Z")

</div>

One thing that does confuse me here @tgxworld is that I thought we stopped with service workers on desktop no?

---

<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: [September 16, 2018, 9:59pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/9 "2018-09-16T21:59:08Z")

</div>

Oh, this is the Firefox bug where it doesn’t properly forward the exact network error all the way through to the interface.

@sam a worker is needed for background notifications, though you can not-register a request handler.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 16, 2018, 10:01pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/10 "2018-09-16T22:01:57Z")

</div>

That was pushed to the desktop push plugin, should not be required for core

---

<div class="post-metadata">

### Author: ![GregoriusTech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gregoriustech/32/111217_2.png) [@GregoriusTech](https://meta.discourse.org/u/GregoriusTech)
#### Post date: [September 16, 2018, 10:04pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/11 "2018-09-16T22:04:57Z")

</div>

I do have the Notifications enabled, just FYI. Unsure how useful that info is.

I also run on 4G LTE based Internet, certain Websites such as Twitter erroneously want to push their “mobile” version of the website to me because of that, but I think they fixed that, well slightly offtopic.

Edit: and yes it was difficult to even find that Error, as it displays the content of the Error Page itself instead of the Error.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [September 17, 2018, 8:38am UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/12 "2018-09-17T08:38:48Z")

</div>

We only disable service workers for apple devices.

> [@riking](#):
>
> Oh, this is the Firefox bug where it doesn’t properly forward the exact network error all the way through to the interface.

@riking Do you know if this is a service worker related bug? From my brief search, it doesn’t seem related to service workers. [Client Challenge](https://support.mozilla.org/en-US/questions/1232773)

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [September 17, 2018, 10:30am UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/13 "2018-09-17T10:30:41Z")

</div>

I’ve had this multiple times in the following Cases:

A Discourse tab was left in the background and resumed with either no network or a different network (4G to Wifi or vice versa) on Laptop only.

I’ve seen this on my crappy asus netbook which randomly disconnects wifi.

Repro is easy if one has an external wifi adapter or something:  
Open Discourse in firefox.  
Put laptop to sleep (not sure if it matters but it happens to me only when waking up to a different network)  
Remove the wireless adapter (let it use internal adapter if your laptop has one or an inbuilt LTE or wired connection)  
Now Just wake up the laptop and it will present a crashed discourse with “Corrupted content error”

---

<div class="post-metadata">

### Author: ![LeoMcA](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leomca/32/87233_2.png) [@LeoMcA](https://meta.discourse.org/u/LeoMcA)
#### Post date: [September 17, 2018, 1:28pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/14 "2018-09-17T13:28:12Z")

</div>

> [@sam](#):
>
> Mozilla run a public Discourse @LeoMcA has anyone reported something like this to the Firefox bug tracker?

Not with Discourse in particular, but with ServiceWorkers in general. This looks to be the expected behaviour when a ServiceWorker errors out in Firefox, but it seems like Chrome lets them fail a little more gracefully:

> **[1256451 - make it easier to recover from a bad service worker](https://bugzilla.mozilla.org/show_bug.cgi?id=1256451)**
>
> RESOLVED (nobody) in Core - DOM: Service Workers. Last updated 2025-06-06.

> [@itsbhanusharma](#):
>
> Repro is easy if one has an external wifi adapter or something:

I can inconsistently repro this (with a fresh profile, on latest release Firefox) on my laptop by toggling my inbuilt wifi adapter on and off. I get the same error as here:

> [@GregoriusTech](#):
>
> I got a screenshot of the Firefox console with the actual error.

I’m no ServiceWorker expert, but I’m willing to bet the spare change in my coat pocket that this is being caused by this section of code:

[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/service-worker.js.erb#L91-L95](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/service-worker.js.erb#L91-L95)

I imagine in this weird network-changing state, `navigator.onLine` is returning true (despite it actually being false), and so an error is being thrown (rather than the offline page being shown) causing Firefox to display the corrupted content error.

Could we check if this error is a network error, and show the offline page in that case too? (Or even wait a little bit, and refresh the page for a user?)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 17, 2018, 10:08pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/16 "2018-09-17T22:08:54Z")

</div>

@tgxworld / @falco / @featheredtoast if we nuke the whole concept of [proxying](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/service-worker.js.erb#L71-L98) by implementing fetch in the service worker, will Android PWA continue to work?

If **yes** I want this code junked. If **no** I want the proxy of fetch to be conditional to Android.

---

<div class="post-metadata">

### Author: ![jmana9](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jmana9/32/111273_2.png) [@jmana9](https://meta.discourse.org/u/jmana9)
#### Post date: [September 17, 2018, 10:25pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/17 "2018-09-17T22:25:30Z")

</div>

I believe that the plugin Privacy Badger causes this to happen _a lot_ with all Discourse sites, for me and one other Firefox user who is test-driving Discourse with me. CTRL + F5 fixes the issue temporarily. Whitelisting Discourse sites greatly reduces the occurrence of these errors.

I reported this to Privacy Badger/EFF about 6 weeks ago. Maybe they fixed it since then, but because I whitelisted the Discourse sites I use, I’ve hardly seen the error and might notice if they implemented a fix.

---

<div class="post-metadata">

### Author: ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)
#### Post date: [September 18, 2018, 4:37pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/18 "2018-09-18T16:37:22Z")

</div>

I’m pretty sure we can have a blank fetch handler and have PWA still work, as long as there is one defined. I’d really like to get offline support going in the future of Discourse, but these issues are definitely frustrating. Wondering if @Falco can chip in for a good path to offline support at this point.

> [@LeoMcA](#):
>
> Could we check if this error is a network error, and show the offline page in that case too? (Or even wait a little bit, and refresh the page for a user?)

I think we did that before, and it caused some confusion when a discourse _server_ went down, and instead of a “not online” page, we wanted to differentiate that it was actually not responding down and here’s the error vs you being offline.

---

<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: [September 18, 2018, 5:27pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/19 "2018-09-18T17:27:52Z")

</div>

> [@GregoriusTech](#):
>
> Funnily enough this even happens when the Internet is fully disconnected. Instead of “Failed to Reach Website” I get “Network Protocol Violation”, meaning the Cache is involved in this aswell.

This a know issue with Privacy Badger: [Is privacy-badger blocking Discourse from loading correctly? · Issue #1953 · EFForg/privacybadger · GitHub](https://github.com/EFForg/privacybadger/issues/1953)

Firefox also had some problems involving service workers and session restore like [1454400 - Session Restore doesn't activate service worker](https://bugzilla.mozilla.org/show_bug.cgi?id=1454400) which affected both Discourse and [Microsoft Developer portal login](https://github.com/MrAlex94/Waterfox/issues/581#issuecomment-391834656).

Looks like there is a new issue with Firefox online detection.

> [@featheredtoast](#):
>
> Wondering if @Falco can chip in for a good path to offline support at this point.

We need to pass the Lighthouse PWA audit, which requires the offline page, which requires the service worker and proxy.

> [@featheredtoast](#):
>
> > [@LeoMcA](#):
> >
> > Could we check if this error is a network error, and show the offline page in that case too? (Or even wait a little bit, and refresh the page for a user?)
> 
> I think we did that before, and it caused some confusion when a discourse _server_ went down, and instead of a “not online” page, we wanted to differentiate that it was actually not responding down and here’s the error vs you being offline.

Exactly, we had that and people complained.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [September 18, 2018, 7:39pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/20 "2018-09-18T19:39:16Z")

</div>

Are you running any third party Firefox plugins @GregoriusTech? If so run in [safe mode](https://meta.discourse.org/t/53504?silent=true) without them to test. Privacy badger has known issues.

---

<div class="post-metadata">

### Author: ![GregoriusTech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gregoriustech/32/111217_2.png) [@GregoriusTech](https://meta.discourse.org/u/GregoriusTech)
#### Post date: [September 18, 2018, 7:52pm UTC](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308/21 "2018-09-18T19:52:19Z")

</div>

As i mentioned above I did try running without any plugins and it still happens reliably.

[Next page](https://meta.discourse.org/t/firefox-experiences-network-protocol-violation-on-discourse-based-websites/97308.md?page=2)
