Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4718

Using different backend based on Path

$
0
0

Hi,
I am new to HAProxy and struggling to configure my path based routing correctly.
I am using consul discovery and load-balance consul service through HAProxy.
Here is my haproxy.cfg

defaults
   mode http

frontend stats
   bind *:1936
   stats uri /
   stats show-legends
   no log

frontend http_front
   bind *:80
   default_backend emailHandler
   acl emailservice path_beg /email
   use_backend emailHandler if emailservice

backend emailHandler
    balance roundrobin
    server-template emailhandler-api 10 _emailhandler-api._tcp.service.consul resolvers consul resolve-opts allow-dup-ip resolve-prefer ipv4 check

resolvers consul
    nameserver consul 127.0.0.1:8600
    accepted_payload_size 8192
    hold valid 5s

When I try to visit http://localhost/email, I get 404. When I remove acl, my service works on http://localhost

I will be registering lot more service with consul and I want to use just one common entrypoint with different url paths for different service. Can someone please help me figure this out?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4718

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>