Skip to content

try ​

try captures the downstream response. If the response status matches and the path can be rewritten, it reruns the downstream chain once with the rewritten path.

yaml
server:
  http:
    middlewares:
      try_fallback:
        try:
          regex: ^/v1/(.*)$
          replacement: /v2/$1
          status_codes: "404,500-502"
FieldDescription
regexGo regex applied to the original path.
replacementReplacement path.
status_codesComma or space separated list. Ranges such as 500-505 are supported.

If the replacement does not change the path, or the captured status is not in status_codes, the original response is returned.