spinframework / spinframework/spin

Http Outbound request's header Host value comes with port number.

Open
#2,325 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
6.5k
Forks
310
Avg merge
1d 20h
Merged PRs (30d)
24

Description

Does outbound http request(with Rust)'s header HOST come with Port number?

Following request goes to AWS to upload S3 object.

let request = Request::builder()
        .method(Method::Put)
        .uri(target)
        .header("Authorization", authorization)
        .header("Content-Length", content_length)
        .header("Content-Type", content_type)
        .header("X-Amz-Content-Sha256", x_amz_content_sha256)
        .header("X-Amz-Date", x_amz_date)
        .body(file.to_vec())
        .build();

Got this from AWS:

content-length:70
content-type:image/png
host:seungjin.s3.amazonaws.com:443
x-amz-content-sha256:4d17e4d1ba1915f55196d1f9c135d2b6cc5cd3a4fd867b02f48e39bb5b37877e
x-amz-date:20240305T075204Z

Above saying host seungjin.s3.amazonaws.com:443 not seungjin.s3.amazonaws.com
I actually trying to overwrite Host header value to test but Amazon is complaining it has a duplicated header.

  1. Is that normal? Shipping Host value with port even it is well-known port(https, 443)?
  2. Can I overwrite the Hearder (such as Host) ?

I checked with some 3rd party tool to catch what host name is.
curl does not ship with port number but Spin's outbound request does.
Also Rust X86 compiled binary using reqwest just ships hostname not with post number in Host header value.
When i create a Mastodon's signing message few month ago, this host and port was a problem. - If hostname is used for signing http request, what I use for my hostname and server's received hostname are not matched(because port num) and signing can't be verified.

https://discord.com/channels/926888690310053918/1214479936396460063

# spin --version
spin 2.4.0-pre0 (8d67954d 2024-03-04)
suthep2~(:|✔)
# spin plugin list --installed
cloud 0.5.1 [installed]
platform 0.1.0 [installed]
pluginify 0.6.0 [installed]
py2wasm 0.3.2 [installed]

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 at the outbound HTTP request construction used by the Rust request builder and reproduce the Host header behavior with the shown AWS S3 request. Compare the emitted Host value with curl and reqwest, then determine whether including :443 is expected and whether overriding Host is supported without duplication; done means the behavior and an AWS-compatible signing path are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.