Skip to content

fetch does not allow caching requests with a null client #1749

Open
@cbiesinger

Description

@cbiesinger

What problem are you trying to solve?

The FedCM spec (https://fedidcg.github.io/FedCM/) makes a number of fetch requests with a null client, such as https://fedidcg.github.io/FedCM/#fetch-config-file. But fetch does not support caching requests with a null client because the cache partition is null (https://fetch.spec.whatwg.org/#network-partition-keys via https://fetch.spec.whatwg.org/#http-cache-partitions). Because these files change rarely, it is desirable to be able to cache them if requested by the server using standard HTTP headers

What solutions exist today?

Only solution today is to cache them in the caller of fetch, which is a lot of complexity to duplicate what the HTTP cache does today

How would you solve it?

Probably one of:

  • add a property to fetch requests named something like "cache fallback environment" that would be used by the cache partition key algorithm
  • allow the fetch caller to specify a network partition key directly (not exposed to JS, of course)

Anything else?

@domfarolino suggested not using the "reserved client" for this purpose because it's meant to be used for navigation requests

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interest

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions