Can fabio proxy by hostname?
Attempting to move to fabio from haproxy. Goals: route traffic coming in to my server based on hostname (server has multiple vips, with unique hostanmes).
I think I'm missing the match up between the fabio.properties definition of proxy.addr and the SERVICE_TAG on the container(consul).
fabio.properties:
proxy.addr 10.10.10.10:80;proto=tcp
log.access.target=stdout
registry.consul.addr = 127.0.0.1:8500
docker-compose.yml:
version: '2'
services:
consul:
image: "consul"
command: agent -server -advertise ${ip} -client 0.0.0.0 -bootstrap-expect=3 -data-dir=/tmp -retry-join=${alt_a} -retry-join=${alt_b}
network_mode: host
ports:
- "8300:8300"
- "8301:8301"
- "8302:8302"
- "8400:8400"
- "8500:8500"
- "8600:53/udp"
environment:
SERVICE_TAGS: "urlprefix-10.10.10.10:80/;proto=tcp"
registrator:
depends_on:
- consul
image: gliderlabs/registrator:latest
command: "consul://127.0.0.1:8500"
volumes:
- /var/run/docker.sock:/tmp/docker.sock
fabio:
image: magiconair/fabio
network_mode: host
ports:
- "9998:9998"
- "80:9999"
volumes:
- /usr/local/consul/fabio:/etc/fabio:ro
"srv690.oppd.oppd-ds.com:consul:8500": { "Address": "", "CreateIndex": 0, "EnableTagOverride": false, "ID": "srv690.oppd.oppd-ds.com:consul:8500", "ModifyIndex": 0, "Port": 8500, "Service": "consul-8500", "Tags": [ "urlprefix-10.10.10.10:80/;proto=tcp" ] },
I feel like it's close. What am I missing?
TCP Services are routed by port only.
If this is an HTTP service just drop the proto=tcp and register urlprefix-host/path as tag.
Check the Readme. It has examples.
I think I got to "hell bent" on using tcp. I went back to http and ensured I had the trailing slash in the service tag and all is well.
Thanks!!
Glad it works now :)