From 51e639b47d29560d9ee2a31a66143ace18b10071 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Wed, 20 Jan 2021 08:27:52 -0600 Subject: [PATCH] Surface URL exclusion for PWA cached content (#21257) --- aspnetcore/blazor/progressive-web-app.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/aspnetcore/blazor/progressive-web-app.md b/aspnetcore/blazor/progressive-web-app.md index bd6c77f1cd..88292a9f17 100644 --- a/aspnetcore/blazor/progressive-web-app.md +++ b/aspnetcore/blazor/progressive-web-app.md @@ -255,11 +255,21 @@ Change the code to the following: ```javascript const shouldServeIndexHtml = event.request.mode === 'navigate' - && !event.request.url.includes('/Identity/'); + && !event.request.url.includes('/Identity/'); ``` If you don't do this, then regardless of network connectivity, the service worker intercepts requests for such URLs and resolves them using `/index.html`. +Add additional endpoints for external authentication providers to the check. In the following example, `/signin-google` for Google authentication is added to the check: + +```javascript +const shouldServeIndexHtml = event.request.mode === 'navigate' + && !event.request.url.includes('/Identity/') + && !event.request.url.includes('/signin-google'); +``` + +No action is required for the Development environment, where content is always fetched from the network. + ### Control asset caching If your project defines the `ServiceWorkerAssetsManifest` MSBuild property, Blazor's build tooling generates a service worker assets manifest with the specified name. The default PWA template produces a project file containing the following property: