Skip to content

If client sends HTTP headers that Spin sets, rename them - #3804

Merged
itowlson merged 1 commit into
spinframework:mainfrom
itowlson:http-client-provided-spin-headers-nope-nope-nope
Nov 22, 2026
Merged

itowlson merged 1 commit into
spinframework:mainfrom
itowlson:http-client-provided-spin-headers-nope-nope-nope

Conversation

@itowlson

Copy link
Copy Markdown
Contributor

Spin uses headers like spin-client-addr and spin-full-url to provide information about the request. What should we do if a client - a sneaky, snaky client - sends those headers itself? At the moment we just shove everything into the headers, which think results in a multi-value header, which is not what an app would expect, and could lead to it misreading the (sneaky, snaky) client header values for the real Spin ones.

This PR proposes renaming client-provided headers that clash with Spin-defined names.

An alternative would be to simply exterminate the client-provided headers for being sneaky and snaky, but I went for renaming so that apps have a workaround if they need to work with a client which is using these header names and does not want/is not able to change them.

Signed-off-by: itowlson <ivan.towlson@fermyon.com>
@itowlson
itowlson requested review from a team, lann and rylev November 20, 2026 00:57

@lann lann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a good incremental improvement.

I think a better long-term solution would be to deliver the information via a new wit interface; maybe something like:

package spin:wasi-http;

interface request-extensions {
   resource request-metadata {
       client-addr: func() -> option<string>; // or whathaveyou
       ...
   }

   use wasi:http/types.{request};

   get-request-metadata: func(request: borrow<request>) -> request-metadata;
}

@itowlson
itowlson merged commit 5c1e951 into spinframework:main Nov 22, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants