When HTTP request traffic hits GatewayHost, the function (envoy_on_request()) is invoked on the request path and the function envoy_on_response() is invoked on the response path.
Lua Filter Config for Kubernetes
Lua Filter Config for Standalone
---apiVersion:enroute.saaras.io/v1kind:HttpFiltermetadata:name:global_lua_filternamespace:enroute-gw-k8sspec:name:global_lua_filtertype:http_filter_luarouteFilterConfig:config:|
function envoy_on_request(request_handle)
request_handle:logInfo("Hello World request")
end
functionenvoy_on_response(response_handle)response_handle:logInfo("HelloWorldresponse")end
# Variables for lua global filter
FILTER_NAME="global_lua_filter"
FILTER_TYPE="http_filter_lua"
FILTER_CONFIG='
function envoy_on_request(request_handle)
request_handle:logInfo("Hello World request")
end
function envoy_on_response(response_handle)
response_handle:logInfo("Hello World response")
end
'
curl -s -X POST localhost:1323/filter \
-d "Filter_name=${FILTER_NAME}" \
-d "Filter_type=${FILTER_TYPE}" \
-d "Filter_config"="${FILTER_CONFIG}"