Skip to content

Commit f534376

Browse files
committed
Updated HAProxy version in example to version 2.3. Updated HAProxy configuration for 2.3. It does not allow the 'debug' statement in the global section. Added 'option httplog' and an 'http-request capture' statement that records the Origin header in the logs.
1 parent 958f4d4 commit f534376

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

example/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
- "name=server1"
1111

1212
haproxy:
13-
image: haproxytech/haproxy-ubuntu:2.2
13+
image: haproxytech/haproxy-ubuntu:2.3
1414
volumes:
1515
- "./haproxy/haproxy.cfg:/etc/haproxy/haproxy.cfg"
1616
- "./haproxy/cors.lua:/etc/haproxy/cors.lua"

example/haproxy/haproxy.cfg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
global
22
log stdout local0
33
lua-load /etc/haproxy/cors.lua
4-
debug
54
stats socket :9000 mode 660 level admin
65

76
defaults
@@ -10,6 +9,7 @@ defaults
109
timeout client 5s
1110
timeout server 5s
1211
log global
12+
option httplog
1313

1414
listen ui
1515
bind :80
@@ -18,6 +18,9 @@ listen ui
1818
listen api
1919
bind :8080
2020

21+
# Log the Origin header
22+
http-request capture req.hdr(Origin) len 20
23+
2124
# Invoke the CORS service on the request to capture the Origin header
2225
http-request lua.cors "GET,PUT,POST", "localhost", "X-Custom-Header"
2326

0 commit comments

Comments
 (0)