question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

offlinePage not route offline requests to the specified path

See original GitHub issue

I tried with a new build after set up this in nuxt.config.js:

modules: [
    [
      "@nuxtjs/pwa",
      {
        manifest: {
          start_url: "/",
        },
        workbox: {
          offlinePage: "/offline.html",
        },
      },
    ],
  ],

I put the offline html in the static directory. It is working properly offline, but not redirect to the offline.html when the page is offline. Please help.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:12
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
harish0507commented, Mar 9, 2021

Same issue here, offline.html is getting precached but offline routes are not getting redirected to /offline.html

nuxt.config.js

...
workbox: {
	dev: process.env.NODE_ENV === 'development',
	cleanupOutdatedCaches: true,
	offlinePage: '/offline.html',
	offlineAssets: ['/images/offline.png'],
	runtimeCaching: [
		{
			urlPattern: '/images/.*',
			handler: 'cacheFirst',
			strategyOptions: {
				cacheName: 'images',
				cacheExpiration: {
					maxEntries: 20,
					maxAgeSeconds: 3600,
				},
			},
		},
		{
			urlPattern: '/api/.*',
			handler: 'networkOnly',
		},
	],
}
...
0reactions
rttmaxcommented, Sep 28, 2022

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

nuxt.js - Redirect to offline page if no cache and ...
I've settled for an offline page whenever a route is not cached, ... setCatchHandler(async ({ event }) => { if (event.request.mode ...
Read more >
Create an offline fallback page - web.dev
Learn how to create a simple offline experience for your app.
Read more >
Goodbye Offline Page
A couple of weeks ago, I took a step back and assessed the situation. Given the fact that we lean heavily into edge...
Read more >
Workbox Module
Please note that enabling offlinePage will disable /.* caching ( offline option) and will route all offline requests to the specified path.
Read more >
Offline and network connectivity support in Progressive ...
getItem( request.url ) ); // If data exists and this page isn't an offline page (assumes that offline // pages have the word...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found