dukecon / dukecon_infra

Setup DukeCon Infrastructure
1 stars 1 forks source link

service worker of PWA must not be cached #27

Closed ahus1 closed 7 years ago

ahus1 commented 7 years ago

The following URL https://latest.dukecon.org/pwa/javaland/2018/service-worker.js should have caching disabled to that browsers load the file on every visit so that the offline application is refreshed.

@ascheman - can you help?

I'm struggling with Puppet to have a local setup (see #26), so I don't have the possibility to try this myself.

Would you allow .htaccess configuration for the pwa to allow this? Could be something like:

# .htaccess
<Files service-worker.js>
FileETag None
Header unset ETag
Header set cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
</Files>

(see: google books link)

ahus1 commented 7 years ago

... the caching of other files should also be limited, but not necessarily to the extent of the service worker.

ahus1 commented 7 years ago

Aktueller Vorschlag - ETag erhalten, der Client darf die Inhalte eine Stunde lang nutzen, und muss anschließend Fragen, ob sich die Ressource geändert hat.

Das gilt nur für die Resourcen der eigentlichen "app", nicht für die geladenen Daten der Konferenz (Vorträge, etc.).

Vorschlag für Puppet (ab Zeile 172):

    # allow .htaccess files in PWA directories to configure i.e. caching headers
    directories  => [
      { path           => '/data/dukecon/latest/pwa',
        allow_override => ['All'],
      },
    ],

Und ich füge dann ins Projekt ein:

#.htaccess
...
Cache-Control "max-age=3600, must-revalidate"
...
ahus1 commented 7 years ago

Done. Works for me.