files

Lets the route answer by itself with files uploaded on it. The case it is for: a UI that needs a resource nothing behind the gateway serves - a font, a stylesheet, a script, an image - typically offline, where the CDN it names is out of reach. You declare the route that takes that path, choose the Files mode under Target, and upload the files.

This is a terminal filter: nothing is proxied and no upstream is called.

A route in the Files mode: a stylesheet and two fonts uploaded under /fonts, each with the name it is served as and its type, then the index, the browser cache and CORS

Parameters

Name Type Required What it does
index string no The file answered at the route's own path, without a name after it - the index.html of a small site. Empty: that path answers 404, only the files' own addresses answer.
cors boolean no Let pages of any origin read the files. Default: true.
maxAge integer no Seconds a browser keeps a file before revalidating it. Default: 3600.

The files themselves are not parameters: they are uploaded on the route, under Target, and live beside it.

Example

A route on /fonts/** in the Files mode, with inter.css and files/inter-latin.woff2 uploaded on it:

predicates:
  - type: path
    args:
      patterns: ["/fonts/**"]
filters:
  - type: files
    args:
      index: inter.css
      cors: true

/fonts/files/inter-latin.woff2 answers the font, /fonts answers inter.css, any other path under /fonts answers 404.

Notes

A UI that names fonts.googleapis.com will not pass through the route by itself. Either point the UI at the gateway, or - offline - resolve that name to the gateway in your DNS and give it a certificate from your own authority on the Application tab of Domains & TLS: the route then answers the host the UI asks for.