How do workers interact with the 'Always Online' feature?


Could anyone give me a bit of information as to how worker functions behave when the origin server has been detected to be offline?

I am planning to use workers to set a cookie as server side code will no longer be reached as I’m turning on caching for the html document. If I additionally have ‘Always Online’ mode turned on, and the origin server is detected to be down, will my worker function still run before the offline cached pages are returned to the client? It’s imperative that the cookie is set for the user, will a worker still set this when it runs before retrieving the offline mode cache?

Cheers for any help

From documentation and other posts, Workers are the very first thing to respond to a request (on a matching route).

Website user -> Worker -> Cache -> Origin server

So you should always be able to interact with the request regardless of the origin, and even build your own “always online” feature with it.