- Alexander Pope: ServiceWorkers Outbreak: index-sw-9a4c43b4b47781ca619eaaf5ac1db.js | JSConf EU 2017 (A really good watch!)
I have a server setup as follows: Nginx -> uWSGI -> Django.
It is vitally important that the client HTML page never hits an error that doesnt auto-matically recover from (The clients are terminals with no attached keyboard).
When the server is updating, I handle GET requests with an updating page that auto refreshes every 10s. However if there is a POST request, Nginx can't handle it, so then there is a time out, and the page never refreshes.
To solve this I see 2 ways:
- Use a service worker to handle the failed POST, cache the results until the server is up again.
- Use a REST interface, whereby the page performs an AJAX request, if it fails handle it in JS. Disadvantage is that every webpage that has a POST needs to be rewritten, Advantage: no sevice worker magic.
Does anyone have any advice on which way to go?