Skip to content

Add headers in wasmtime serve via CLI #11925

@rajsite

Description

@rajsite

Feature

I'd like the ability to specify / override headers that are passed through requests when using wasmtime serve. Handy for specifying cookies, api keys, etc expected to be in each request to the wasm component being served.

Benefit

Make it easier to simulate authenticated sessions / being behind a proxy or gateway that adds expected headers from cli when testing.

Implementation

Following the curl -H cli would be nice.

(just reproducing from the curl docs):

wasmtime serve -H "X-First-Name: Joe" main.wasm
wasmtime serve -H "User-Agent: yes-please/2000" main.wasm
wasmtime serve -H "Host:" main.wasm
wasmtime serve -H @headers.txt main.wasm

Alternatives

Been setting up a small proxy in node to simulate that and it's pretty cumbersome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wasmtime:serveIssues related to `wasmtime serve`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions