- name: service_bin
connect_timeout: 25s
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
hosts: [{ socket_address: { address: httpbin.org, port_value: 443 }}]
tls_context: { sni: httpbin.org }function envoy_on_request(request_handle)
-- overrides package.path
package.path = package.path .. ";/path/to/json.lua"
json = require "json"
local headers, body = request_handle:httpCall(
"service_bin",
{
[":method"] = "GET",
[":path"] = "/ip",
[":authority"] = "httpbin.org"
},
"",
5000)
request_handle:logInfo(json.decode(body)["origin"])
end