New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: ngsw navigation path exceptions #20404
Comments
Stream of comments on Slack as I dealt with this problem: Adam Fanello [4:34 PM] Adam Fanello [8:14 PM] Adam Fanello [8:51 PM] Adam Fanello [9:42 PM] Adam Fanello [10:42 PM] |
We also need this for angular.io. The usecase: cc @IgorMinar, @alxhub |
@gkalpak this is a feature that was omitted from the new SW in the hopes that navigation-detection would prove sufficient. I think the current blacklist approach which detects URLs with |
Normally, the ServiceWorker will redirect navigation requests that don't match any `asset` or `data` group to the specified index file. Yet, sometimes it is desirable to configure the SW to ignore specific URLs (even for navigation requests) and pass them through to the server. This commit adds support for specifying an optional `ignoredUrlPatterns` list in `ngsw-config.json`, which contains URLs or simple globs (currently only recognizing `*` and `**`). Requests matching these URLs or patterns will not be handled by the SW. Fixes angular#20404
Normally, the ServiceWorker will redirect navigation requests that don't match any `asset` or `data` group to the specified index file. Yet, sometimes it is desirable to configure the SW to ignore specific URLs (even for navigation requests) and pass them through to the server. This commit adds support for specifying an optional `ignoredUrlPatterns` list in `ngsw-config.json`, which contains URLs or simple globs (currently only recognizing `*` and `**`). Requests matching these URLs or patterns will not be handled by the SW. Fixes angular#20404
Would a list of regexes be more flexible? https://developers.google.com/web/tools/workbox/modules/workbox-build |
Let's discuss on #23025. |
Normally, the ServiceWorker will redirect navigation requests that don't match any `asset` or `data` group to the specified index file. Yet, sometimes it is desirable to configure the SW to ignore specific URLs (even for navigation requests) and pass them through to the server. This commit adds support for specifying an optional `ignoredUrlPatterns` list in `ngsw-config.json`, which contains URLs or simple globs (currently only recognizing `*` and `**`). Requests matching these URLs or patterns will not be handled by the SW. Fixes angular#20404
The ServiceWorker will redirect navigation requests that don't match any `asset` or `data` group to the specified index file. The rules for a request to be classified as a navigation request are as follows: 1. Its `mode` must be `navigation`. 2. It must accept a `text/html` response. 3. Its URL must match certain criteria (see below). By default, a navigation request can have any URL except for: 1. URLs containing `__`. 2. URLs to files (i.e. containing a file extension in the last path segment). While thse rules are fine in many cases, sometimes it is desirable to configure different rules for the URLs of navigation requests (e.g. ignore specific URLs and pass them through to the server). This commit adds support for specifying an optional `navigationUrls` list in `ngsw-config.json`, which contains URLs or simple globs (currently only recognizing `!`, `*` and `**`). Only requests whose URLs match any of the positive URLs/patterns and none of the negative ones (i.e. URLs/patterns starting with `!`) will be considered navigation requests (and handled accordingly by the SW). (This is an alternative implementation to angular#23025.) Fixes angular#20404
The ServiceWorker will redirect navigation requests that don't match any `asset` or `data` group to the specified index file. The rules for a request to be classified as a navigation request are as follows: 1. Its `mode` must be `navigation`. 2. It must accept a `text/html` response. 3. Its URL must match certain criteria (see below). By default, a navigation request can have any URL except for: 1. URLs containing `__`. 2. URLs to files (i.e. containing a file extension in the last path segment). While thse rules are fine in many cases, sometimes it is desirable to configure different rules for the URLs of navigation requests (e.g. ignore specific URLs and pass them through to the server). This commit adds support for specifying an optional `navigationUrls` list in `ngsw-config.json`, which contains URLs or simple globs (currently only recognizing `!`, `*` and `**`). Only requests whose URLs match any of the positive URLs/patterns and none of the negative ones (i.e. URLs/patterns starting with `!`) will be considered navigation requests (and handled accordingly by the SW). (This is an alternative implementation to angular#23025.) Fixes angular#20404
The ServiceWorker will redirect navigation requests that don't match any `asset` or `data` group to the specified index file. The rules for a request to be classified as a navigation request are as follows: 1. Its `mode` must be `navigation`. 2. It must accept a `text/html` response. 3. Its URL must match certain criteria (see below). By default, a navigation request can have any URL except for: 1. URLs containing `__`. 2. URLs to files (i.e. containing a file extension in the last path segment). While these rules are fine in many cases, sometimes it is desirable to configure different rules for the URLs of navigation requests (e.g. ignore specific URLs and pass them through to the server). This commit adds support for specifying an optional `navigationUrls` list in `ngsw-config.json`, which contains URLs or simple globs (currently only recognizing `!`, `*` and `**`). Only requests whose URLs match any of the positive URLs/patterns and none of the negative ones (i.e. URLs/patterns starting with `!`) will be considered navigation requests (and handled accordingly by the SW). (This is an alternative implementation to angular#23025.) Fixes angular#20404
The ServiceWorker will redirect navigation requests that don't match any `asset` or `data` group to the specified index file. The rules for a request to be classified as a navigation request are as follows: 1. Its `mode` must be `navigation`. 2. It must accept a `text/html` response. 3. Its URL must match certain criteria (see below). By default, a navigation request can have any URL except for: 1. URLs containing `__`. 2. URLs to files (i.e. containing a file extension in the last path segment). While these rules are fine in many cases, sometimes it is desirable to configure different rules for the URLs of navigation requests (e.g. ignore specific URLs and pass them through to the server). This commit adds support for specifying an optional `navigationUrls` list in `ngsw-config.json`, which contains URLs or simple globs (currently only recognizing `!`, `*` and `**`). Only requests whose URLs match any of the positive URLs/patterns and none of the negative ones (i.e. URLs/patterns starting with `!`) will be considered navigation requests (and handled accordingly by the SW). (This is an alternative implementation to angular#23025.) Fixes angular#20404
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a...
Current behavior
The service worker isNavigationRequest() function assumes that any page navigation within scope is to be handled by the service worker. There are cases were this is not desired behavior.
Expected behavior
Provide a means of configuring exception paths that are checked in isNavigationRequest().
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Example need: Hosting server services and authentication via Feathers.js expects to navigate to the path /auth/google to initiate an OAUTH2 authentication via Google; with completion of authentication directing back to /auth/google/callback. These requests must go through to the server. Currently ngsw-worker.js intercepts these requests and return the start page HTML.
Environment
The text was updated successfully, but these errors were encountered: