Skip to content

Routing

Ajit Verma edited this page Sep 6, 2021 · 5 revisions

Overview

Config Reference

# titanSideCars.ingress.routes[].
# titanSideCars.egress.routes[].
  match:            RouteMatch
  route:            RouteAction
  directResponse:   DirectResponse
  redirect:         RouteRedirect

match

(RouteMatch, required)

route

(RouteAction, optional oneof) Oneof route or directResponse or redirect. If none is specified then requests matching the routing defintion will get routed to local-myapp cluster

directResponse

(DirectResponse, optional oneof) Oneof route or directResponse or redirect. Return an arbitrary HTTP response directly, without proxying.

redirect

(RouteRedirect, optional oneof) Oneof route or directResponse or redirect. Return a redirect.


RouteAction

# titanSideCars.ingress.routes[].route.
# titanSideCars.egress.routes[].route.

  cluster:            string
  prefixRewrite:      string
  regexRewrite:
    pattern:          string
    substitution:     string
  autoHostRewrite:    bool
  retryPolicy:
    numRetries:       integer
    retryOn:          string
  timeout:            string
  idleTimeout:        string

cluster

(string, required) Name of cluster to route to. The specified cluster must exist in the cluster map

prefixRewrite

(string, optional) Indicates that during forwarding, the matched prefix (or path) should be swapped with this value

regexRewrite

(object, optional) Indicates that during forwarding, portions of the path that match the pattern should be rewritten, even allowing the substitution of capture groups from the pattern into the new path as specified by the rewrite substitution string

regexRewrite.pattern

(string, required) The regular expression used to find portions of a string (hereafter called the “subject string”) that should be replaced

regexRewrite.substitution

(string, required) The string that should be substituted into matching portions of the subject string during a substitution operation to produce a new string.

autoHostRewrite

(bool, optional) Indicates that during forwarding, the host header will be swapped with the hostname of the upstream host chosen by the cluster manager. This attribute is only relavant on egress path.

retryPolicy

(object, optional) Indicates that the route has a retry policy.

retryPolicy.numRetries

(integer, required) Specifies the allowed number of retries

retryPolicy.retryOn

(string, required) Specifies the conditions under which retry takes place

timeout

(string, optional) Specifies the upstream timeout for the route. If not specified, the default is 15s. This spans between the point at which the entire downstream request (i.e. end-of-stream) has been processed and when the upstream response has been completely processed. A value of 0 will disable the route’s timeout

idleTimeout

(string, optional) Specifies the idle timeout for the route. If not specified, there is no per-route idle timeout, although the connection manager wide idle timeout setting will still apply. A value of 0 will completely disable the route’s idle timeout, even if a connection manager stream idle timeout is configured


DirectResponse

# titanSideCars.ingress.routes[].directResponse.
# titanSideCars.egress.routes[].directResponse.

  status:   integer
  body:     string

status

(integer, required) Http status code to return

body

(string, optional) Http response body to return


RouteRedirect

# titanSideCars.ingress.routes[].redirect.
# titanSideCars.egress.routes[].redirect.
  action:       enum
  value:        contextual-based-on-action
  responseCode: integer
  regex:        string

action

(enum, required)

  • https_redirect: The scheme portion of the URL will be swapped with “https”. Takes a boolean value.
  • scheme_redirect: The scheme portion of the URL will be swapped with associated value. Takes a string value.
  • host_redirect: The host portion of the URL will be swapped with associated value. Takes a string value.
  • port_redirect: The port value of the URL will be swapped with associated value. Takes an integer value.
  • path_redirect: The path portion of the URL will be swapped with associated value. Takes a string value.
  • prefix_rewrite: Indicates that during redirection, the matched prefix (or path) should be swapped with associated value. This option allows redirect URLs be dynamically created based on the request. Takes a string value.
  • regex_rewrite: Indicates that during redirect, portions of the path that match the pattern should be rewritten, even allowing the substitution of capture groups from the pattern into the new path as specified by the rewrite substitution string

value

(required) Value associated with specified redirect action.

responseCode

(integer, optional) The HTTP status code to use in the redirect response. The default response code is MOVED_PERMANENTLY (301).

regex

(string, optional) Only relevant if action is regex_rewrite and specified the pattern to match.


Examples