Skip to main content

Wildcard Routing and Testing

Use this guide when your proxy path ends with /* and you need one proxy to handle variable suffixes.

When to use wildcard proxies​

Use wildcard paths when the exact child path is not known ahead of time, for example:

  • File/blob download paths (/files/*)
  • Static asset passthrough (/assets/*)
  • Nested partner routes (/partner/*)

Avoid wildcard paths when you can define a bounded, schema-driven path (for example /users/{id}), because explicit parameterized routes are easier to validate and document.

Authoring pattern​

In proxy configuration:

  • Path: use suffix wildcard, e.g. /files/*
  • Target Path: use the matching backend wildcard form expected by the upstream (commonly /storage/* or similar)
  • Methods: restrict to only what the upstream supports

Example:

  • Incoming gateway path: /api/files/reports/2026/q1.csv
  • Collection base path: /api
  • Proxy path: /files/*
  • Target path: /storage/*
  • Forwarded upstream path: /storage/reports/2026/q1.csv

The wildcard part of the request (reports/2026/q1.csv) replaces the * at the end of the target path. If the target path has no *, the wildcard part is appended to it, so target /storage gives the same result.

Matching and precedence notes​

Routing still respects the collection and proxy matching rules:

  1. Match collection base path.
  2. Check the client profile's allowed methods, if it has any (during authentication).
  3. Match proxy path against candidate routes (by path only).
  4. Check the request method against the matched proxy's allowed methods.

How a wildcard path matches:

  • /files/* matches /files, /files/ and any path below it, at any depth (/files/a, /files/a/b/c.js). It does not match /filesystem/a.
  • * only acts as a wildcard at the end of a path. Elsewhere it is a literal character, and so are ., + and other punctuation (/v1.2/items matches only /v1.2/items).
  • Path parameters can come before the wildcard: /files/{id}/* matches /files/42/raw/x.txt, and {id} can be used in the target path (/blobs/{id}/*).
  • An exact path (/files/manifest) or a parameterized path with the same number of segments wins over a wildcard path, whatever order the proxies were created in.
  • A request whose wildcard part contains . or .. segments (also percent-encoded, such as %2e%2e) is refused with 400 before anything is sent upstream, so callers cannot climb out of the target path.

For overlapping patterns, prefer explicit routes for critical operations and keep wildcard routes as catch-all handlers. Validate behavior with real traffic examples before publishing.

Portal testing flow for wildcard routes​

In Developer Portal testing console:

  1. Open endpoint with wildcard path.
  2. Use the wildcard path input to provide the suffix only.
  3. Add query params if your upstream expects them.
  4. Send and validate response status, body, and latency.

Test matrix (recommended):

  • Shallow suffix: /logo.svg
  • Medium depth suffix: /reports/q1.csv
  • Deep suffix: /region/us-east/customers/42/export.json

Failure signatures​

  • 400: the wildcard part of the path contains . or .. segments.
  • 404: wildcard route did not match as expected, or target path rewrite is incorrect.
  • 405: method is not enabled on proxy or blocked by profile method restrictions.
  • 401/403: profile auth or access constraints failed.
  • 429: policy limits were exceeded.

Validation checklist​

  1. Published wildcard proxy resolves expected suffixes.
  2. Target path rewrite is correct for each suffix depth.
  3. Unauthorized request fails with expected status.
  4. Request appears in logs with expected path, method, and client/profile context.