Skip to content

Eskip File

Eskip file dataclient can be used to serve static defined routes, read from an eskip file. The file format eskip shows your route definitions in a clear way:

% cat example.eskip
hello: Path("/hello") -> "https://www.example.org"

The Skipper project has two binaries, one is skipper, the other is eskip. Eskip can be used to validate the syntax of your routes file before reloading a production server:

% eskip check example.eskip

To run Skipper serving routes from an eskip file you have to use -routes-file <file> parameter:

% skipper -routes-file example.eskip

A more complicated example with different routes, matches, predicates and filters shows that you can name your route and use preconditions and create, change, delete HTTP headers as you like:

% cat complicated_example.eskip
hostHeaderMatch:
         Host("^skipper.teapot.org$")
         -> setRequestHeader("Authorization", "Basic YWRtaW46YWRtaW5zcGFzc3dvcmQK")
         -> "https://target-to.auth-with.basic-auth.enterprise.com";
baiduPathMatch:
        Path("/baidu")
        -> setRequestHeader("Host", "www.baidu.com")
        -> setPath("/s")
        -> setQuery("wd", "godoc skipper")
        -> "http://www.baidu.com";
googleWildcardMatch:
        *
        -> setPath("/search")
        -> setQuery("q", "godoc skipper")
        -> "https://www.google.com";
yandexWildacardIfCookie:
        * && Cookie("yandex", "true")
        -> setPath("/search/")
        -> setQuery("text", "godoc skipper")
        -> tee("http://127.0.0.1:12345/")
        -> "https://yandex.ru";

The former example shows 4 routes: hostHeaderMatch, baiduPathMatch, googleWildcardMatch and yandexWildcardIfCookie.

More examples you find in eskip file format description, in filters and in predicates.

Eskip file format is also used if you print your current routes in skipper, for example:

% curl localhost:9911/routes
*
  -> setResponseHeader("Content-Type", "application/json; charset=utf-8")
  -> inlineContent("{\"foo\": 3}")
  -> <shunt>