Data Enrichment
The HUMAN Fastly Enforcer provides a hook function where processing is performed on the data enrichment payload
px_custom.vcl
contains the custom hook function px_custom_data_enrichment_handler
.
The function receives the following headers:
X-PX-data-enrichment
: A JSON string with data enrichment.X-PX-data-enrichment-validated
: A boolean flag indicating when data enrichment is trusted and has not been tampered with (possible values: 0 or 1)
To extract values from the JSON object, set: req.http.X-PX-de-value = if (req.http.X-PX-data-enrichment ~ {“”VALUE_HERE”:”([^”]*)”}, re.group.1, “”)
;
When it is determined that the request should be passed to the backend server, set the X-PX-de-pass-request = “1”
Example:
px_custom_data_enrichment_handler {
set req.http.X-PX-de-f-type = if (req.http.X-PX-data-enrichment ~ {“”f_type”:”([^”]*)”},
re.group.1, “”);
if (req.http.X-PX-de-f-type == “w”) {
set req.http.X-PX-de-pass-request = “1”;
}
}
Updated 12 days ago