mozilla / remote-newtab

Remotely-hosted New Tab Page
https://mozilla.github.io/remote-newtab/src/
Mozilla Public License 2.0
15 stars 7 forks source link

Add Service-Worker-Allowed HTTP header to CDN #128

Open marcoscaceres opened 8 years ago

marcoscaceres commented 8 years ago

The CDN needs to make sure it allows sw.js to be loaded from the js folder by declaring the "Service-Worker-Allowed:" HTTP header.

marcoscaceres commented 8 years ago

To be clear, the header needs to be on the sw.js file, and the value of the header needs to be:

 Service-Worker-Allowed: "/" 
oyiptong commented 8 years ago

got it

oyiptong commented 8 years ago

Added in quick-and-dirty deploy automation:

https://github.com/oyiptong/qnd-rnt-automation/commit/d54c4596a37c5cd8bd8559061d34b7044b4c8b1e

oyiptong commented 8 years ago

note: we expect the Service Worker files to end with sw.js

marcoscaceres commented 8 years ago

Fancy Python is fancy!

Sent from my iPhone

On Nov 3, 2015, at 3:52 AM, Olivier Yiptong notifications@github.com wrote:

Added in quick-and-dirty deploy automation:

oyiptong/qnd-rnt-automation@d54c459

— Reply to this email directly or view it on GitHub.

marcoscaceres commented 8 years ago

I thinks that's a very reasonable assumption:+1:

Sent from my iPhone

On Nov 3, 2015, at 3:53 AM, Olivier Yiptong notifications@github.com wrote:

note: we expect the Service Worker files to end with sw.js

— Reply to this email directly or view it on GitHub.

oyiptong commented 8 years ago

hmm S3 doesn't let us use that header yet:

http://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonResponseHeaders.html

oyiptong commented 8 years ago

sadness... looks like we'll have to stick with sw.js being co-located with the html file

marcoscaceres commented 8 years ago

Sad😢 ok, I'll move those commits to another branch for when they add it.

Sent from my iPhone

On Nov 3, 2015, at 6:38 AM, Olivier Yiptong notifications@github.com wrote:

hmm S3 doesn't let us use that header yet:

http://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonRequestHeaders.html

— Reply to this email directly or view it on GitHub.

oyiptong commented 8 years ago

it looks like our CDN supports custom headers, however:

http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html#RequestCustomRemovedHeaders

We can move off of S3 if we wanted to.

oyiptong commented 8 years ago

We can make that a v2 bug. We'd handle the serving of the files on our own. And Cloudfront would pick up the headers

oyiptong commented 8 years ago

Google Cloud Storage also doesn't seem to support custom headers: https://cloud.google.com/storage/docs/reference-headers

I can't really figure out Azure Object Storage.

Worse comes to worse, we have our own instance of Nginx serving static files. It will be cheap.

oyiptong commented 8 years ago

Rackspace also doesn't allow for custom headers:

https://developer.rackspace.com/docs/cloud-files/v1/developer-guide/#document-general-api-info/response-codes