Skip to content

Consolidate route-vhost config: gateway_host (WebSub) vs vhosts (REST) #3322

Description

@renuka-fernando

Description

The platform derives a route's vhost from two different config keys depending on which half of the gateway handles the request, which is inconsistent and confusing.

  • Main gateway (REST / LLM / MCP): the route vhost comes from router.vhosts.main / router.vhosts.sandbox. The router.gateway_host value is never read on this path.
  • Event gateway (WebSub): the route vhost comes from router.gateway_host. The vhosts config is never read on this path.

So the same conceptual field — "the vhost segment of a route key" — is sourced from vhosts in one component and gateway_host in the other.

Evidence:

  • Event gateway uses gateway_host as the vhost when building SUB/UNSUB policy-chain route keys: event-gateway/gateway-controller/pkg/policyhooks/event_channel_translator.go:368 and :399 call xds.GenerateRouteName("SUB"/"UNSUB", apiData.Context, apiData.Version, chName, routerConfig.GatewayHost).
  • GenerateRouteName(method, context, apiVersion, path, vhost string) (gateway/gateway-controller/pkg/xds/translator.go:168) uses that 5th argument as the route key's vhost segment.
  • The event-gateway shares the main controller's config struct (event_channel_translator.go:32 imports github.com/wso2/api-platform/gateway/gateway-controller/pkg/config), so both keys live on the same RouterConfig.
  • The main gateway's REST/LLM/MCP translation uses getVHostDomains / the vhosts config exclusively (gateway/gateway-controller/pkg/xds/translator.go:974-1013) and never reads GatewayHost.

Important: gateway_host is therefore NOT dead config — it is load-bearing for event-gateway route naming. It is only unused within the main gateway, which makes it look removable at a glance. Removing it would break WebSub route-key generation.

Why this matters

An operator configuring the gateway sees both router.gateway_host and router.vhosts.* and has no way to tell that one governs WebSub and the other governs REST. Changing gateway_host has no effect on REST APIs; changing vhosts has no effect on WebSub. This is closely related to the default vs domains confusion tracked in #3321.

Proposal (pick/refine)

  • Preferred: unify the WebSub route-vhost derivation with the same vhosts config the main gateway uses, so there is a single source of truth for a route's vhost, and deprecate router.gateway_host.
  • Or, if they must stay separate: document explicitly that gateway_host governs only the event-gateway (WebSub) and vhosts governs only REST/LLM/MCP, and consider validating/warning when one is set in a deployment that doesn't use it.
  • Either way, add a code comment on RouterConfig.GatewayHost (gateway/gateway-controller/pkg/config/config.go:542) noting it is consumed by the event-gateway, so it is not mistaken for dead config and removed.

Affected areas

  • gateway/gateway-controller/pkg/config/config.go (RouterConfig.GatewayHost)
  • event-gateway/gateway-controller/pkg/policyhooks/event_channel_translator.go
  • gateway/gateway-controller/pkg/xds/translator.go (GenerateRouteName, getVHostDomains)
  • kubernetes/helm/gateway-helm-chart/values.yaml + templates/gateway/gateway-config.yaml
  • kubernetes/helm/operator-helm-chart/values.yaml, kubernetes/gateway-operator/config/*

Version

No response

Related Issue

Related to #3321 and #403 (which introduced the vhosts config for the main gateway, leaving gateway_host used only by the event-gateway).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area/EventGatewayIssues related to Event GatewayArea/GatewayAny issues related to API deployment in gateway, routing etc.Aspect/ConfigurationConfig files, settings, env vars, defaultsType/Improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions