I have been researching JavaScript service works for the last 2 years on and off, and I am very weary of them, e.g.

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:

  1. Use a service worker to handle the failed POST, cache the results until the server is up again.
  2. 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?

  • What are the possible POST requests when the server is updating? Ever thought blue/green deployments where you have two redundant systems where you could switch back and forth for updates and in case anything goes wrong? Nov 25 at 8:52
  • @ThomasJunk, blue/green would be great, but at the moment the database is local to the machine. Maybe that will be a future feature in a few years time ;) Nov 25 at 9:10
  • Any reason why its been downvoted? Nov 25 at 17:59
  • Seems like the typical Stack Overflow manner: Downvote and go -.- Nov 26 at 7:16
  • 1
    Well, this seems like more of a troubleshooting question to me, not something we really do here. Nov 26 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.