Skip to content

Add support for overriding connect address #3550

@lann

Description

@lann

This is primarily useful in testing or private networking scenarios where the client wants to nominally connect to a host but use a different address than DNS would resolve, e.g.:

  • An override is configured for api.example.com -> test-api.example.com
  • Guest makes a request to https://api.example.com
  • TCP connection is established to test-api.example.com
  • TLS establishment uses api.example.com as the server name
  • HTTP Host header is api.example.com

This effect is sometimes achieved instead by overriding the HTTP Host header, but this will typically cause server certificate validation to fail which then requires separate TLS config changes (often just e.g. --insecure).

I see two (not necessarily exclusive) approaches:

Override in runtime config

Something like:

[outbound_networking.hosts."api.example.com"]
override_resolution = "test-api.example.com"

This would be relatively straightforward to implement and would cover many use cases but might not work well where more dynamic configuration is needed.

Override in the guest

I think the most "component-y" way to implement this would be with a new WIT interface(s) that would be sort of "extension(s)" to WASI:

package spin:wasi-extensions;

interface http-extensions {
  use wasi:http/types@0.3.0-rc-2026-03-15.{request};

  set-connect-host(request: borrow<request>, connect-host: string) -> result<_, some-error>;
}

The connect-host would need to be covered by an allowed_outbound_hosts entry or some new manifest (allowed_host_overrides?) and/or runtime config allowlist mechanism.

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