question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

serviceworker will not work on http sites on Chrome

See original GitHub issue

The error is:

Error: Service worker registration failed: SecurityError: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).
    at ?name=management.js:30
    at <anonymous>

https://github.com/psiinon/zap-hud/issues/17#issuecomment-329535344

where the shortened link resolves to: https://www.chromium.org/Home/chromium-security/prefer-secure-origins-for-powerful-new-features

For example, Chrome is going to make Service Workers available only to secure origins, because it provides the origin with a new, higher degree of control over a user’s interactions with the origin over an extended period of time, and because it gives the origin some control over the user’s device as a background task.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
psiinoncommented, May 31, 2018

So I decided the easiest way to answer this was with code - #128 😉

1reaction
psiinoncommented, May 30, 2018

The current plan is:

For HTML content requested by chrome/jxbrowser over http when the HUD is active:

  • Redirect the browser to HTTPS (using https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta ?)
  • Detect https failures and flag the domain (so we dont keep requesting https content)
  • For all flagged domains, request the contents via http and fake the https response
  • Provide some popup or other visual clue to explain what we’re doing to the user

Thoughts anyone?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is Service worker not working in Chrome? - Stack Overflow
From what I understand, service workers do not work on all browsers, but I checked to see if it runs in Chrome (which...
Read more >
Service Worker Debugging - The Chromium Projects
A: Service workers are only available to "secure origins" (HTTPS sites, basically) in line with a policy to prefer secure origins for powerful...
Read more >
Service worker overview - Chrome Developers
Service workers are an enhancement to existing websites. This means that if users on browsers that don't support service workers visit websites ......
Read more >
Chromium Docs - Service Worker Security FAQ
Why doesn't Chrome prompt the user before registering a Service Worker? What if I don't want any SWs? What are some SW best...
Read more >
Handling Service Worker updates – how to keep the app ...
The update problem ... Service Worker is a piece of JavaScript that works as a single controller & network proxy for all the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found