Skip to content
Frank Schröder edited this page Jul 16, 2016 · 11 revisions

This is how you use fabio in your setup:

  1. Register your service in consul.

    Make sure that each instance registers with a unique ServiceID.

  2. Register a health check in consul as described here.

    Make sure the health check is passing since fabio will only watch services which have a passing health check.

  3. Register one urlprefix- tag per host/path prefix it serves, e.g.:

    • urlprefix-/css
    • urlprefix-i.com/static
    • urlprefix-mysite.com/

    Make sure the prefix contains at least one slash (/).

  4. Start fabio without a config file (assuming a running consul agent on localhost:8500) Watch the log output how fabio picks up the route to your service. Try starting/stopping your service to see how the routing table changes instantly.

  5. Send all your HTTP traffic to fabio on port 9999

  6. Done

To start a sample server to test the routing run the demo/server like this:

./server -addr 127.0.0.1:5000 -name svc-a -prefix /foo

and access the server direct and via fabio

curl 127.0.0.1:5000/foo   # direct
curl 127.0.0.1:9999/foo   # via fabio

fabio can terminate TLS connections and handle client certificate authentication. Check the documentation on Certificate Stores for details.

To test how fabio routes requests check the Debugging section.