-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathhaproxy.cfg
47 lines (38 loc) · 1.11 KB
/
haproxy.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Simple HAProxy Configuration
# Global settings
global
log stdout format raw daemon
# Default settings
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
log global
option httplog
option dontlognull
# Frontend to accept incoming requests on port 80
frontend http-in
bind *:80
# Define ACLs to match request paths
acl is_auth path_beg /api/auth
acl is_discounts path_beg /api/discounts
acl is_items path_beg /api/items
acl is_root path_beg /
# Use corresponding backend based on ACL
use_backend auth-backend if is_auth
use_backend discounts-backend if is_discounts
use_backend items-backend if is_items
use_backend frontend-backend if is_root
# Backend for the auth service
backend auth-backend
server auth1 localhost:3001
# Backend for the discounts service
backend discounts-backend
server discounts1 localhost:3002
# Backend for the items service
backend items-backend
server items1 localhost:3003
# Backend for the frontend service
backend frontend-backend
server frontend1 127.0.0.1:3000