Skip to content

wasi-http 0.3: instance reuse means middleware world cannot implement CDN-Loop #919

@pchickey

Description

@pchickey

The wasi-http 0.3 middleware world, as well as the work done to make instance reuse the default, are both features I'm strongly in favor of. The trouble comes with the intersection of those features, which I think breaks some assumptions. @cfallin first brought this issue up in #918.

CDN-Loop is a header that we expect many wasi-http embedders to require in their implementations of wasi-http middleware worlds. In short, the implementation will read the CDN-Loop header out of the incoming request, parse out the values specific to their CDN, possibly choose to block the request if those values exceed some limit, and otherwise the implementation will hand the request to a wasi-http middleware world's exported handler. Then, the implementation of the wasi-http middleware's imported handler needs to take the request and add a CDN-Loop header with all of the values from the inciting request's header, plus an added (on first hop) or modified (when appending a hop) value specific to the CDN. This is straightforward to implement in wasi-http 0.2, and indeed many implementations do so today.

However, with instance reuse, once there are multiple simultaneous requests passed to the exported handler, it is no longer possible for an implementation to associate a call of middleware's imported handler with the inciting request of middleware's exported handler. This ambiguity makes impossible to implement CDN-Loop correctly, and if implemented incorrectly CDN-Loop could end up either incorrectly blocking benign requests, or failing to block requests that should be blocked, neither of which a CDN can tolerate.

Inside any correct middleware component, with instance reuse or not, there is an association between an incoming request and the outgoing request, in order to turn the outgoing request's response to the incoming request's response. Instance reuse, and the current shape of the middleware wit world, makes it impossible for the implementation of the middleware world to maintain that association. Host magic to solve this doesn't exist, and even if it did, we want this exact sort of thing to be implementable with virtualization anyway.

CDN-Loop is just one example in the broader category of problems caused by loosing association between the inbound request and outbound request in a middleware or proxy. This problem presents in other ways specific to the embeddings that @cfallin and I maintain for F5, as well, but CDN-Loop is a representative example that exists across many vendors, so I figured its the best way to discuss it in the standard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions