w3c / w3c/ServiceWorker

support efficient offline redirects

Open
#1,457 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Bikeshed
Stars
3.6k
Forks
324
Avg merge
14d 22h
Merged PRs (30d)
1

Description

From talking with a number of sites it seems we don't currently have a great way of handling offline redirects. In this use case a site may have

vanity.com => (redirect to) => actual.com

If actual.com uses a service worker to provide offline support it has no way to make the vanity.com redirect function offline.

Of course, it is possible to register a service worker on vanity.com with a FetchEvent handler that provides the offline redirect, but that is very heavyweight. It not only requires spinning up a worker thread to handle the event, but in browsers that implement site isolation it also requires creating a new process.

You can further extend this because some sites I've talked to actually have multiple redirects in a chain they have to deal with.

A comprehensive declarative API like proposed in #1373 would be one way to solve this. It would allow the service worker on vanity.com to declare the redirect without requiring a FetchEvent to be fired.

I also wonder if there is some way to address this in a smaller API via something like #1454.

I wanted to file this as a separate issue, though, just to get the use case on people's minds.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the related proposals in issues #1373 and #1454, then compare how each could support offline redirects without firing a FetchEvent. Done would require a decided API design that handles vanity redirects and redirect chains offline.

Written by the indexing model from the issue text.

Assessment

Domain
api, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.