Skip to content

Commit

Permalink
feat: datadome.lua 1.3.3 Update (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitpuertolas authored May 3, 2024
1 parent 229eff6 commit 9b5c54c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion datadome-istio/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
appVersion: "1.3.1"
description: A Helm chart for Kubernetes
name: datadome-istio
version: 0.4.3
version: 0.4.4
10 changes: 2 additions & 8 deletions datadome-istio/files/datadome.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ local DATADOME_URI_PATTERNS_EXCLUSION = options['URI_PATTERNS_EXCLUSION'] or {

local DATADOME_MODULE_NAME="Envoy"

local DATADOME_MODULE_VERSION="1.3.2"
local DATADOME_MODULE_VERSION="1.3.3"

local DATADOME_REQUEST_PORT=0

Expand Down Expand Up @@ -103,12 +103,6 @@ end

local hostname = gethostname()

local function getClientIP(request_handle)
-- we can't get IP address here otherwise when X-Forwarded-For
ip = string.gsub(request_handle:headers():get("x-forwarded-for") or "", ",.*", "")
return ip
end

local function getCurrentMicroTime()
-- we need time up to microseccconds, but at lua we can do up to seconds :( round it
return tostring(os.time()) .. "000000"
Expand Down Expand Up @@ -244,7 +238,7 @@ function envoy_on_request(request_handle)
["RequestModuleName"] = DATADOME_MODULE_NAME,
["ModuleVersion"] = DATADOME_MODULE_VERSION,
["ServerName"] = hostname,
["IP"] = getClientIP(request_handle),
["IP"] = headers:get("x-envoy-external-address"),
["Port"] = DATADOME_REQUEST_PORT,
["TimeRequest"] = getCurrentMicroTime(),
["Protocol"] = headers:get("x-forwarded-proto"),
Expand Down

0 comments on commit 9b5c54c

Please sign in to comment.