global
log stdout format raw local0
daemon
defaults
log global
mode http
option httplog
timeout client 30s
timeout connect 10s
timeout server 30s
frontend main
bind :5000
# Declare filter and its config file
filter spoe engine test-socket config /usr/local/etc/haproxy/spoe-test.conf
filter spoe engine test config /usr/local/etc/haproxy/spoe-test.conf
# Use the filter
# https://www.haproxy.com/blog/extending-haproxy-with-the-stream-processing-offload-engine
tcp-request content reject if { var(sess.spoe_test_socket.ip_score) -m int lt 20 }
# to log the IP score
http-request capture var(sess.spoe_test_socket.ip_score) len 3
http-after-response set-header X-SPOE-VAR_SOCKET %[var(txn.spoe_test_socket.my_var)]
http-after-response set-header X-SPOE_VAR_TCP %[var(txn.spoe_test.my_var)]
default_backend app
backend app
mode http
http-request return status 200 content-type "text/plain" string "Hello"
backend spoe-test
mode tcp
#option spop-check
server rust-agent 127.0.0.1:12345 #check
backend spoe-test-socket
mode tcp
#option spop-check
server local-agent unix@/var/run/haproxy/spoa.sock #check