Skip to content

Service Worker loaded from CDN #591

Open
@florianmutter

Description

Do you want to request a feature or report a bug?
Report a Bug

What is the current behaviour?
sw.js is loaded from a CDN if a CDN is set in the webpack publicPath. This is forbidden:
Failed to register a ServiceWorker: The origin of the provided scriptURL ('https://yourcdn.net') does not match the current origin ('https://yourapp.com').

If the current behaviour is a bug, please provide the steps to reproduce.
Add the following snippet to preact.config.js:

config.output.publicPath = '//youcdn.net/';

It seems this was introduced in #323

What is the expected behaviour?
sw.js must be loaded from the base domain. See w3c/ServiceWorker#940

Please mention other relevant information.

  • Node version: v6.10.3
  • npm version: 3.10.10
  • Operating system: macOS
  • CLI version: 2.2.1
  • Browser: Chrome 67.0.3396.87

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions