Route Filter To Perform Host Redirects

RouteFilter Redirect

Perform a Host Redirect traffic per-route by creating a RouteFilter and attaching it to a Route in GatewayHost or ServiceRoute

apiVersion: enroute.saaras.io/v1
kind: RouteFilter
  name: host-redirect
  namespace: httpbin
spec:
  name: host-redirect
  routeFilterConfig:
    config: |
      {
            "host_redirect" : "httpbin-post-handler.saaraslabs.com"
      }
  type: route_filter_redirect

Example GatewayHost with redirect config

apiVersion: enroute.saaras.io/v1
kind: GatewayHost
  name: httpbin-9000-gatewayhost-httpbin-host
  namespace: httpbin
spec:
  routes:
  - conditions:
    - prefix: /get
    services:
    - name: httpbin
      port: 9000
  - conditions:
    - prefix: /post
    enableWebsockets: true
    filters:
    - name: host-redirect
      type: route_filter_redirect
    retryPolicy:
      count: 3
      perTryTimeout: 5s
    services:
    - name: httpbin
      port: 9000
    timeoutPolicy:
      request: 250ms
  virtualhost:
    fqdn: '*'