With Traffic Policy, you can use CEL interpolation to dynamically forward requests to different internal endpoints based on URL request attributes, including but not limited to:
  • URL
  • hostname
  • path
  • headers
This allows you to manage complex traffic topologies without manually creating and managing each forward-internal action. This page contains examples of rules that route requests based on different request attributes. See the forward-internal Traffic Policy action docs for more information.

Based on URL

This rule forwards requests from https://*.example.com to https://<SUBDOMAIN>.internal.
on_http_request:
  -     name: Route requests based on URL
    actions:
      -         type: forward-internal
        config:
          url: https://${req.host.split(".example.com")[0]}.internal

Based on headers

This rule forwards requests containing a X-Customer-Value: {CUSTOMER} header to https://{CUSTOMER}.internal.
on_http_request:
  actions:
    -       type: forward-internal
      config:
        url: https://${getReqHeader('X-Customer-Value')[0]}.internal