redirect

Sends the visitor to another URL with an HTTP redirect.

Phaseson_http_request
Terminating Yes — once it answers, nothing after it runs.
Cost 10 Traffic Policy units per run · not on the Free plan

Example

policy.yaml
on_http_request:
  - name: MoveDocs
    actions:
      - type: redirect
        config:
          from: "^https://[^/]+/old-docs/(.*)$"
          to: "https://docs.example.com/$1"
          status_code: 301

Start an agent endpoint with it: devgate http 8080 --traffic-policy-file policy.yaml, or paste it into a reserved or cloud endpoint’s Traffic Policy tab in the dashboard.

Configuration

Field Type Description
to
required
string Where to send the visitor. With from, it can use the regex’s capture groups ($1, $2…).
from string A regular expression matched against the full URL (https://host/path?query). When it doesn’t match, the action is skipped.
status_code integer A 3xx status: 301 or 308 for permanent, 302 or 307 for temporary. Default: 302.
headers map Up to 10 extra response headers.

Behaviour

  • A redirect that would point at the URL already requested is skipped, so it can’t loop on itself.

Other actions

add-headers remove-headers compress-response basic-auth oauth openid-connect jwt-validation custom-response deny url-rewrite restrict-ips rate-limit circuit-breaker verify-webhook http-request set-vars log close-connection forward-internal