Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Application Load Balancer
  • Getting started
    • All guides
    • Creating Application Load Balancer infrastructure through a wizard
      • Creating an HTTP router for HTTP traffic
      • Creating an HTTP router for gRPC traffic
      • Getting information about an HTTP router
      • Editing an HTTP router
      • Deleting an HTTP router
    • Viewing operations with resources
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • L7 load balancer logs
  • Release notes

In this article:

  • Adding a route to a virtual host
  • Change your virtual host’s route order
  1. Step-by-step guides
  2. HTTP routers
  3. Editing an HTTP router

Updating HTTP router settings

Written by
Yandex Cloud
Updated at May 13, 2025
  • Adding a route to a virtual host
  • Change your virtual host’s route order

To update HTTP router settings:

Management console
CLI
Terraform
API
  1. In the management console, select the folder with your HTTP router.
  2. Select Application Load Balancer.
  3. In the left-hand panel, select HTTP routers.
  4. Click your router name.
  5. Click Edit.
  6. Edit your router (virtual host, route) settings.
  7. Click Save at the bottom of the page.

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. See the description of the CLI command for updating an HTTP router:

    yc alb http-router update --help
    
  2. Run this command with new router settings specified:

    yc alb http-router update <HTTP_router_name> --new-name <new_name_for_HTTP_router>
    

    Result:

    id: a5dld80l32ed********
    name: new-http-router
    folder_id: aoe197919j8e********
    virtual_hosts:
    - name: test-virtual-host
      authority:
      - your-domain.foo.com
      routes:
      - name: test-route
        http:
          match:
            path:
              prefix_match: /
          route:
            backend_group_id: a5d4db973944********
            timeout: 2s
            idle_timeout: 3s
      modify_request_headers:
      - name: Accept-Language
        append: ru-RU
    created_at: "2021-02-11T21:31:01.676592016Z"
    

If you do not have Terraform yet, install it and configure its Yandex Cloud provider.

  1. Open the Terraform configuration file and edit the fragment describing your HTTP router.

    ...
    resource "yandex_alb_http_router" "tf-router" {
      name   = "my-http-router"
      labels = {
        tf-label    = "tf-label-value"
        empty-label = ""
      }
    }
    ...
    

    For more information about yandex_alb_http_router properties, see this Terraform article.

  2. To add, update, or delete HTTP router virtual hosts, use the yandex_alb_virtual_host resource with your router ID specified in its http_router_id field:

    resource "yandex_alb_virtual_host" "my-virtual-host" {
      name           = "my-virtual-host"
      http_router_id = "${yandex_alb_http_router.tf-router.id}"
      route {
        name = "my-route"
        http_route {
          http_route_action {
            backend_group_id = "${yandex_alb_backend_group.backend-group.id}"
            timeout          = "3s"
          }
        }
      }
    }
    

    For more information about yandex_alb_virtual_host properties, see this Terraform article.

  3. Check the configuration using this command:

    terraform validate
    

    If your configuration is correct, you will get this message:

    Success! The configuration is valid.
    
  4. Run this command:

    terraform plan
    

    You will see a detailed list of resources. No changes will be made at this step. If your configuration contains errors, Terraform will show them.

  5. Apply the changes:

    terraform apply
    
  6. Type yes and press Enter to confirm changes.

    You can check your HTTP router updates in the management console or using this CLI command:

    yc alb http-router get <HTTP_router_ID>
    

Use the update REST API method for the HttpRouter resource or the HttpRouterService/Update gRPC API call.

Adding a route to a virtual hostAdding a route to a virtual host

To add a new route to your HTTP router's virtual host:

Management console
CLI
Terraform
API
  1. In the management console, select the folder with your HTTP router.
  2. Select Application Load Balancer.
  3. In the left-hand panel, select HTTP routers.
  4. Click your router name.
  5. Click Edit.
  6. Click Add route.
  7. Specify your route settings and click Save.

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

See the description of the CLI command for managing virtual hosts:

yc alb virtual-host --help
  • HTTP

    You can add a new route at the beginning, end, or any position within the route list.

    Add a route at the end of the list

    1. See the description of the CLI command for adding a route at the end of the route list:

      yc alb virtual-host append-http-route --help
      
    2. Run this command:

      yc alb virtual-host append-http-route <route_name> \
        --virtual-host-name <virtual_host_name> \
        --http-router-name <HTTP_router_name> \
        --match-http-method <HTTP_method> \
        --exact-path-match / \
        --backend-group-name <backend_group_name> \
        --request-timeout <request_timeout>s \
        --request-idle-timeout <request_idle_timeout>s \
        --rate-limit rps=<request_limit>,requests-per-ip
      

      For more information about yc alb virtual-host append-http-route options, see this CLI reference.

      Result:

      name: test-virtual-host
      authority:
      - your-domain.foo.com
      routes:
      - name: test-route
      ...
      - name: test-route-toend
        http:
          match:
            path:
              prefix_match: /
          route:
            backend_group_id: a5d3e9ko2qf0********
            timeout: 2s
            idle_timeout: 3s
      

    Add a route at the beginning of the list

    1. See the description of the CLI command for adding a route at the beginning of the route list:

      yc alb virtual-host prepend-http-route --help
      
    2. Run this command:

      yc alb virtual-host prepend-http-route <route_name> \
        --virtual-host-name <virtual_host_name> \
        --http-router-name <HTTP_router_name> \
        --match-http-method <HTTP_method> \
        --exact-path-match / \
        --backend-group-name <backend_group_name> \
        --request-timeout <request_timeout>s \
        --request-idle-timeout <request_idle_timeout>s \
        --rate-limit rps=<request_limit>,requests-per-ip
      

      For more information about yc alb virtual-host prepend-http-route options, see the CLI reference.

      Result:

      name: test-virtual-host
      authority:
      - your-domain.foo.com
      routes:
      - name: test-route-tostart
        http:
          match:
            http_method:
            - GET
            path:
              exact_match: /
          route:
            backend_group_id: a5d3e9ko2qf0********
            timeout: 2s
            idle_timeout: 3s
      - name: test-route
      ...
      

    Add a route before another route

    1. See the description of the CLI command for adding a route before another route:

      yc alb virtual-host insert-http-route --help
      
    2. Run this command:

      yc alb virtual-host insert-http-route <route_name> \
        --virtual-host-name <virtual_host_name> \
        --before <route_name_to_be_preceded_by_new_route> \
        --http-router-name <HTTP_router_name> \
        --match-http-method <HTTP_method> \
        --exact-path-match / \
        --backend-group-name <backend_group_name> \
        --request-timeout <request_timeout>s \
        --request-idle-timeout <request_idle_timeout>s \
        --rate-limit rps=<request_limit>,requests-per-ip
      

      For more information about yc alb virtual-host insert-http-route options, see this CLI reference.

      Result:

      done (2s)
      name: test-virtual-host
      authority:
      - your-domain.foo.com
      routes:
      ...
      - name: test-route-insbefore
        http:
          match:
            http_method:
            - GET
            path:
              exact_match: /
          route:
            backend_group_id: a5d3e9ko2qf0********
            timeout: 2s
            idle_timeout: 3s
      - name: test-route
      ...
      

    Add a route after another route

    1. See the description of the CLI command for adding a new route after another route:

      yc alb virtual-host insert-http-route --help
      
    2. Run this command:

      yc alb virtual-host insert-http-route <route_name> \
        --virtual-host-name <virtual_host_name> \
        --after <route_name_to_be_followed_by_new_route> \
        --http-router-name <HTTP_router_name> \
        --match-http-method <HTTP_method> \
        --exact-path-match / \
        --backend-group-name <backend_group_name> \
        --request-timeout <request_timeout>s \
        --request-idle-timeout <request_idle_timeout>s \
        --rate-limit rps=<request_limit>,requests-per-ip
      

      For more information about yc alb virtual-host insert-http-route options, see this CLI reference.

      Result:

      done (2s)
      name: test-virtual-host
      authority:
      - your-domain.foo.com
      routes:
      - name: test-route
      ...
      - name: test-route-insafter
        http:
          match:
            path:
              prefix_match: /
          route:
            backend_group_id: a5d3e9ko2qf0********
            timeout: 2s
            idle_timeout: 3s
      ...
      
  • gRPC

    You can add a new route at the beginning, end, or any position within the route list.

    Add a route at the end of the list

    1. See the description of the CLI command for adding a route at the end of the route list:

      yc alb virtual-host append-grpc-route --help
      
    2. Run this command:

      yc alb virtual-host append-grpc-route <route_name> \
        --virtual-host-name <virtual_host_name> \
        --http-router-name <HTTP_router_name> \
        --prefix-fqmn-match /<first_word_of_service_name> \
        --backend-group-name <backend_group_name> \
        --request-max-timeout <timeout>s \
        --rate-limit rps=<request_limit>,requests-per-ip
      

      For more information about yc alb virtual-host append-grpc-route options, see this CLI reference.

      Result:

      name: <virtual_host_name>
      authority:
      - *
      routes:
      - name: grpc-route
      ...
      - name: grpc-route-toend
        grpc:
          match:
            fqmn:
             prefix_match: /helloworld
          route:
            backend_group_id: ds7snban2dvn********
            max_timeout: 60s
            auto_host_rewrite: false
      

    Add a route at the beginning of the list

    1. See the description of the CLI command for adding a route at the beginning of the route list:

      yc alb virtual-host prepend-grpc-route --help
      
    2. Run this command:

      yc alb virtual-host prepend-grpc-route <route_name> \
        --virtual-host-name <virtual_host_name> \
        --http-router-name <HTTP_router_name> \
        --prefix-fqmn-match /<first_word_of_service_name> \
        --backend-group-name <backend_group_name> \
        --request-max-timeout <timeout>s \
        --rate-limit rps=<request_limit>,requests-per-ip
      

      For more information about yc alb virtual-host prepend-grpc-route options, see this CLI reference.

      Result:

      name: <virtual_host_name>
      authority:
      - *
      routes:
      - name: grpc-route-tostart
        grpc:
          match:
            fqmn:
             prefix_match: /helloworld
          route:
            backend_group_id: ds7snban2dvn********
            max_timeout: 60s
            auto_host_rewrite: false
      - name: grpc-route
      ...
      

    Add a route before another route

    1. See the description of the CLI command for adding a route before another route:

      yc alb virtual-host insert-grpc-route --help
      
    2. Run this command:

      yc alb virtual-host insert-grpc-route <route_name> \
        --virtual-host-name <virtual_host_name> \
        --before <route_name> \
        --http-router-name <HTTP_router_name> \
        --prefix-fqmn-match /<first_word> \
        --backend-group-name <backend_group_name> \
        --request-max-timeout <timeout>s \
        --rate-limit rps=<request_limit>,requests-per-ip
      

      Where:

      • --virtual-host-name: Name of the virtual host where you want to add a route.
      • --before: Route name following your new route.
      • --http-router-name: HTTP router name.
      • --prefix-fqmn-match: Service name first word.
      • --backend-group-name: Backend group name.
      • --request-max-timeout: Timeout in seconds.

      For more information about yc alb virtual-host insert-grpc-route options, see this CLI reference.

      Result:

      name: grpc-host
      authority:
      - *
      routes:
      ...
      - name: grpc-route-before
        grpc:
          match:
            fqmn:
             prefix_match: /helloworld
          route:
            backend_group_id: ds7snban2dvn********
            max_timeout: 60s
            auto_host_rewrite: false
      - name: grpc-route
      ...
      

    Add a route after another route

    1. See the description of the CLI command for adding a new route after another route:

      yc alb virtual-host insert-grpc-route --help
      
    2. Run this command:

      yc alb virtual-host insert-grpc-route <route_name> \
        --virtual-host-name <virtual_host_name> \
        --after <route_name> \
        --http-router-name <HTTP_router_name> \
        --prefix-fqmn-match /<first_word> \
        --backend-group-name <backend_group_name> \
        --request-max-timeout <timeout>s \
        --rate-limit rps=<request_limit>,requests-per-ip
      

      Where:

      • --virtual-host-name: Name of the virtual host where you want to add a route.
      • --after: Route name before your new route.
      • --http-router-name: HTTP router name.
      • --prefix-fqmn-match: Service name first word.
      • --backend-group-name: Backend group name.
      • --request-max-timeout: Timeout in seconds.

      For more information about yc alb virtual-host insert-grpc-route options, see this CLI reference.

      Result:

      name: grpc-host
      authority:
      - *
      routes:
      ...
      - name: grpc-route
      ...
      - name: grpc-route-after
         grpc:
        match:
           fqmn:
           prefix_match: /helloworld
        route:
           backend_group_id: ds7snban2dvn********
           max_timeout: 60s
           auto_host_rewrite: false
      ...
      

If you do not have Terraform yet, install it and configure its Yandex Cloud provider.

  1. Open the Terraform configuration file and add the route section to your virtual host description:

    resource "yandex_alb_virtual_host" "my-virtual-host" {
      name           = "my-virtual-host"
      http_router_id = "${yandex_alb_http_router.tf-router.id}"
      route {
        name = "my-route"
        http_route {
          http_route_action {
            backend_group_id = "${yandex_alb_backend_group.backend-group.id}"
            timeout          = "3s"
          }
        }
      }
    }
    

    For more information about yandex_alb_virtual_host properties, see this Terraform article.

    The order of routes in the list matters. For more information, see this article.

  2. Check the configuration using this command:

    terraform validate
    

    If your configuration is correct, you will get this message:

    Success! The configuration is valid.
    
  3. Run this command:

    terraform plan
    

    You will see a detailed list of resources. No changes will be made at this step. If your configuration contains errors, Terraform will show them.

  4. Apply the changes:

    terraform apply
    
  5. Type yes and press Enter to confirm changes.

    You can check virtual host updates in the management console or using this CLI command:

    yc alb virtual-host get <virtual_host_ID>
    

Use the update REST API method for the VirtualHost resource or the VirtualHostService/Update gRPC API call.

Change your virtual host’s route orderChange your virtual host’s route order

To change route order in the HTTP router:

Management console
CLI
API
  1. In the management console, select the folder with your HTTP router.
  2. Select Application Load Balancer.
  3. In the left-hand panel, select HTTP routers.
  4. Click your router name.
  5. Click Edit.
  6. Click Sort.
  7. In the window that opens, drag your route to a new position in the list.
  8. Click Save.
  9. Once you finish edits, click Save.
  • HTTP

    1. See the description of the CLI command for deleting a route:

      yc application-load-balancer virtual-host remove-http-route --help
      
    2. Delete a route:

      yc alb virtual-host remove-http-route <route_name> \
        --virtual-host-name <virtual_host_name> \
        --http-router-name <router_name>
      
    3. Add your route at a required position as described above.

  • gRPC

    1. See the description of the CLI command for deleting a route:

      yc application-load-balancer virtual-host remove-gRPC-route --help
      
    2. Delete a route:

      yc alb virtual-host remove-grpc-route <route_name> \
        --virtual-host-name <virtual_host_name> \
        --http-router-name  <router_name>
      
    3. Add your route at a required position as described above.

Use the update REST API method for the VirtualHost resource or the VirtualHostService/Update gRPC API call.

Was the article helpful?

Previous
Getting information about an HTTP router
Next
Deleting an HTTP router
Yandex project
© 2025 Yandex.Cloud LLC