Title: Ability to pass options to service worker's fetch request(s). · Issue #38907 · angular/angular · GitHub
Open Graph Title: Ability to pass options to service worker's fetch request(s). · Issue #38907 · angular/angular
X Title: Ability to pass options to service worker's fetch request(s). · Issue #38907 · angular/angular
Description: Versions Angular CLI: 1.7.3 Node: 8.11.1 OS: darwin x64 Angular: 5.2.9 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router, service-worker @angular...
Open Graph Description: Versions Angular CLI: 1.7.3 Node: 8.11.1 OS: darwin x64 Angular: 5.2.9 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-...
X Description: Versions Angular CLI: 1.7.3 Node: 8.11.1 OS: darwin x64 Angular: 5.2.9 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-...
Opengraph URL: https://github.com/angular/angular/issues/38907
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Ability to pass options to service worker's fetch request(s).","articleBody":"### Versions\r\n```\r\nAngular CLI: 1.7.3\r\nNode: 8.11.1\r\nOS: darwin x64\r\nAngular: 5.2.9\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... http, language-service, platform-browser\r\n... platform-browser-dynamic, router, service-worker\r\n\r\n@angular/cdk: 5.2.4\r\n@angular/cli: 1.7.3\r\n@angular/flex-layout: 5.0.0-beta.14\r\n@angular/material: 5.2.4\r\n@angular-devkit/build-optimizer: 0.3.2\r\n@angular-devkit/core: 0.3.2\r\n@angular-devkit/schematics: 0.3.2\r\n@ngtools/json-schema: 1.2.0\r\n@ngtools/webpack: 1.10.2\r\n@schematics/angular: 0.3.2\r\n@schematics/package-update: 0.3.2\r\ntypescript: 2.6.2\r\nwebpack: 3.11.0\r\n```\r\n\r\n### Observed behavior\r\nOur app is located behind a security gateway and is using a service worker. The service worker was integrated following [this guide](https://angular.io/guide/service-worker-getting-started). Because of the fact that *any* request is passed through the security gateway we had to provide additional options to the construction of any `Request` object, namely `credentials` and `mode`, when a service worker is requesting its manifest from the server. Otherwise manifest fetch fails with CORS error:\r\n\r\n> No 'Access-Control-Allow-Origin' header is present on the requested resource.\r\n\r\n### Desired behavior\r\nIf I could use the `ngsw-config.json` file, or some other means of configuration, to set some global options which in return are applied to any fetch request. Like so:\r\n```\r\n{\r\n\r\n \"index\": \"index.html\",\r\n \"request-options\": {\r\n \"credentials\" : \"same-origin\",\r\n \"mode\": \"cors\"\r\n },\r\n \"assetGroups\": [\r\n {\r\n \"name\": \"app\",\r\n \"installMode\": \"prefetch\",\r\n \"resources\": {\r\n \"files\": [\r\n \"/assets/images/favicon.png\",\r\n \"/index.html\"\r\n ],\r\n \"versionedFiles\": [\r\n \"/*.bundle.css\",\r\n \"/*.bundle.js\",\r\n \"/*.chunk.js\"\r\n ]\r\n }\r\n },\r\n {\r\n \"name\": \"assets\",\r\n \"installMode\": \"lazy\",\r\n \"updateMode\": \"prefetch\",\r\n \"resources\": {\r\n \"files\": [\r\n \"/assets/**\"\r\n ],\r\n \"urls\": [\r\n \"https://fonts.googleapis.com/**\"\r\n ]\r\n }\r\n }\r\n ]\r\n}\r\n```\r\n","author":{"url":"https://github.com/ghost","@type":"Person","name":"ghost"},"datePublished":"2018-04-19T14:00:28Z","url":"https://github.com/angular/angular/issues/38907"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c8a73778-ac0a-e20b-6ac4-a0e9c0f0c231 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED94:785A9:EBB3A3:12B556B:6B010A7D |
| html-safe-nonce | 6ffcbd2ba1c3b2450a8ef172fa292d1c7f55a4d7027ab80fad698a7573c49a1e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDk0Ojc4NUE5OkVCQjNBMzoxMkI1NTZCOjZCMDEwQTdEIiwidmlzaXRvcl9pZCI6IjY4NjExOTUzODc5Nzg0NTE1ODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2e93957f19e5d38281825153880f880818544dbb4aeb45f84d889e33421a6d1a |
| hovercard-subject-tag | issue:704888816 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/38907/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8fa41781a9c09393e3daae98308e7cdcf66f4c92df96ca22decd71a6b3fe2e3a/angular/angular/issues/38907 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8fa41781a9c09393e3daae98308e7cdcf66f4c92df96ca22decd71a6b3fe2e3a/angular/angular/issues/38907 |
| og:image:alt | Versions Angular CLI: 1.7.3 Node: 8.11.1 OS: darwin x64 Angular: 5.2.9 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ghost |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width