All Products
Search
Document Center

Alibaba Cloud Service Mesh:Host redirection

Last Updated:Jun 20, 2026

You can configure host redirection to redirect requests destined for a specific service host to a different one.

Prerequisites

Ensure you have deployed the httpbin, sleep, and nginx services as described in Preparation.

Procedure

  1. Create a VirtualService that forwards requests destined for the httpbin service to the nginx service.

    1. Log on to the ASM console. In the navigation pane on the left, choose Service Mesh > Mesh Management.

    2. On the Mesh Management page, click the name of the target instance. In the navigation pane on the left, choose Traffic Management Center > VirtualService, and then click Create.

    3. On the Create page, set the namespace to default, the service name to httpbin, and the destination host for the HTTP route to nginx.default.svc.cluster.local. Click Preview to review the YAML content. If the content is correct, click Submit and then click Create.

      Preview YAML

      apiVersion: networking.istio.io/v1beta1
      kind: VirtualService
      metadata:
        name: httpbin
        namespace: default
      spec:
        hosts:
          - httpbin.default.svc.cluster.local
        http:
          - route:
              - destination:
                  host: nginx.default.svc.cluster.local
  2. Run the following command to verify that the host redirection is working.

    kubectl exec -it deploy/sleep -- curl httpbin:8000|grep -o "<title>.*</title>"

    Expected output:

    <title>Welcome to nginx!</title>

    The response is from the nginx service, which confirms that the request from the sleep container to the httpbin service's root path was successfully redirected to nginx.

    Important

    In Ambient Mesh mode, if you configure host redirection to a destination service, do not deploy a waypoint proxy for that service.