Blazor wasm not working on cloudflare Pages

I’m keep getting error: “This site can’t be reached” after refreshing the published page.
The first load (or after cleaning the site caches) it successfully load first time, but all rest loads bring me that error.

I have followed your instructions from this page:

I have added a custom domain, own DNS and added the CNAME successfully. Both custom domain and the url which created by cloudflare Pages giving the same results.

I took clean out of the box template from visual studio of Blazor webassembly with Progressive Web Application.

The app run well on first load, then on page refresh i get this error. If i clean site caches then again same. First load is working but all other loads/refreshing brings me that error.

Any idea why this error is happening??

I suspect it might connect to redirect issues or something with the caches.

I appreciate your help :slight_smile:

Ever managed to figure this one out?

Actually yes.

In the file “service-worker.published”
I simple modifided as the following:

async function onInstall(event) {‘Service worker: Install’);

// Fetch and cache all matching items from the assets manifest
const assetsRequests = self.assetsManifest.assets
    .filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url)))
    .filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url)))
    .map(asset => new Request(asset.url, { integrity: asset.hash }));
await => {
    return fetch('/offline')
        .then(response => cache.put('/offline', new Response(response.body)));
notifyNewVersion(); // this is optional, function to notify for a new version


Than its started to work without any issues.

As well if you dont want the progressive web app (able to install), then you don’t need this “service-worker” at all and it works very well as well (without this code part because the whole file is not exists then.)