Created
July 23, 2020 18:20
-
-
Save haproxytechblog/53bf3354a2c1cef8fa5058d209ff8575 to your computer and use it in GitHub Desktop.
Announcing HAProxy Data Plane API 2.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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" | |
} | |
] | |
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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" | |
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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