Skip to content

Registered SW broken on iOS 16.4 #39

@epernice

Description

@epernice

I have an application that is based on cra-template-pwa-typescript, which has been working great on iPads until iOS 16.4.

After updating to iOS 16.4, it no longer works. The application loads on the first load (after clearing website data, for example). Subsequent loads pull an empty index.html from the service worker and the browser displays a blank page.

I reproduced this in a minimal case by creating and deploying a new application based on cra-template-pwa-typescript. I saw the same issue.

Some extra details about how I am reproducing that may not matter

The only code change I made to the template was to register the service worker in index.tsx:

serviceWorkerRegistration.register({
  onUpdate: registration => {
    registration.waiting?.postMessage({ type: "SKIP_WAITING" });
  }
});

I made one configuration change to package.json to deploy it under a context path

  "homepage": "/testpwa",

I built it in node:16.13.2, and deployed it in nginx:1.19

Location sections from my nginx.conf are:

    location /testpwa {
        # First attempt to serve request as file, then
        # as directory, then fall back to redirecting to index.html
        alias /var/www/;

        if ( $uri = '/testpwa/index.html' ) {
          add_header Cache-Control no-store always;
        }

        try_files $uri $uri/ /testpwa/index.html;
    }

    location /testpwa/static {
        alias /var/www/static/;
        expires 1M;
        access_log off;
        add_header Cache-Control "public";
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions