Add service worker hook. Move cookie setting to a low-level HTTP layer.