Skip to content

Commit

Permalink
Updated HAProxy version in example to version 2.3. Updated HAProxy co…
Browse files Browse the repository at this point in the history
…nfiguration 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.
  • Loading branch information
NickMRamirez committed Mar 21, 2021
1 parent 958f4d4 commit f534376
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- "name=server1"

haproxy:
image: haproxytech/haproxy-ubuntu:2.2
image: haproxytech/haproxy-ubuntu:2.3
volumes:
- "./haproxy/haproxy.cfg:/etc/haproxy/haproxy.cfg"
- "./haproxy/cors.lua:/etc/haproxy/cors.lua"
Expand Down
5 changes: 4 additions & 1 deletion example/haproxy/haproxy.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
global
log stdout local0
lua-load /etc/haproxy/cors.lua
debug
stats socket :9000 mode 660 level admin

defaults
Expand All @@ -10,6 +9,7 @@ defaults
timeout client 5s
timeout server 5s
log global
option httplog

listen ui
bind :80
Expand All @@ -18,6 +18,9 @@ listen ui
listen api
bind :8080

# Log the Origin header
http-request capture req.hdr(Origin) len 20

# Invoke the CORS service on the request to capture the Origin header
http-request lua.cors "GET,PUT,POST", "localhost", "X-Custom-Header"

Expand Down

0 comments on commit f534376

Please sign in to comment.