← Back to context

Comment by yawaramin

13 days ago

This is easy to solve. Just configure htmx to automatically add an `Accept-Version` header to its requests:

    document.addEventListener('htmx:configRequest', evt => {
      evt.detail.headers['Accept-Version'] = APP_VERSION;
    });

And have a middleware that checks for this header. If it finds a version mismatch, have it respond with an HTTP 400 and a message to update the app to get the latest version. This is pretty similar to what many SPAs are already doing nowadays so it shouldn't come as a big surprise.