Skip to content

Instantly share code, notes, and snippets.

@haproxytechblog
Created July 23, 2020 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haproxytechblog/53bf3354a2c1cef8fa5058d209ff8575 to your computer and use it in GitHub Desktop.
Save haproxytechblog/53bf3354a2c1cef8fa5058d209ff8575 to your computer and use it in GitHub Desktop.
Announcing HAProxy Data Plane API 2.1
$ curl -X PUT \
'http://127.0.0.1:5555/v2/services/haproxy/configuration/global?version=1' \
-H 'authorization: Basic YWRtaW46YWRtaW4=' \
-H 'content-type: application/json' \
-d '{
"lua_loads": [
{
"file": "/etc/haproxy/foo.lua"
}
]
}'
$ curl -X POST \
'http://127.0.0.1:5555/v2/services/haproxy/configuration/http_request_rules?parent_type=frontend&parent_name=http-1&version=1' \
-H 'authorization: Basic YWRtaW46YWRtaW4=' \
-H 'content-type: application/json' \
-d '{
"index": 0,
"type": "lua",
"lua_action": "checkip",
"lua_params": "127.0.0.1 5000"
}'
global
lua-load /etc/haproxy/foo.lua
frontend http-1
http-request lua.checkip 127.0.0.1 5000
# other settings...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment