You are here

datadome_integration_init.html.twig in Fastly 8.3

sub set_origin_header {
if (req.backend.is_origin) {
if (req.backend == datadome) {
set bereq.http.x-datadome-params:key = "{{ datadome_api_key }}";
set bereq.http.x-datadome-params:requestmodulename = "FastlyMagento";
set bereq.http.x-datadome-params:moduleversion = "2.10";
set bereq.http.x-datadome-params:timerequest = time.start.usec;
set bereq.http.x-datadome-params:servername = server.identity;
set bereq.http.x-datadome-params:serverregion = server.region;
set bereq.http.x-datadome-params:ip = req.http.fastly-client-ip;
set bereq.http.x-datadome-params:authorizationlen = std.strlen(req.http.authorization);
unset bereq.http.authorization;
if (req.http.x-datadome-clientid) {
set bereq.http.x-datadome-params:clientid = urlencode(req.http.x-datadome-clientid);
set bereq.http.x-datadome-x-set-cookie = "true";
} else {
set bereq.http.x-datadome-params:clientid = urlencode(req.http.cookie:datadome);
}
set bereq.http.x-datadome-params:cookieslen = std.strlen(req.http.cookie);
unset bereq.http.cookie;
} else {
# prevent leak of the key
unset bereq.http.x-datadome-params;
}
}
}

backend datadome {
.host = "api-fastly.datadome.co";
.port = "8443";
.connect_timeout = {{ datadome_connect_timeout }}ms;
.first_byte_timeout = {{ datadome_between_bytes_timeout }}ms;
.between_bytes_timeout = {{ datadome_between_bytes_timeout }}ms;
.max_connections = 200;
.ssl = true;
.dynamic = true;
.probe = {
.request = "HEAD /.well-known/healthcheck-datadome HTTP/1.1" "Host: api-fastly.datadome.co" "Connection: close" "User-Agent: Varnish/fastly (healthcheck)";
.expected_response = 200;
.initial = 5;
.interval = 2s;
.threshold = 1;
.timeout = 2s;
.window = 5;
}
}

File

fastly_edge_modules/templates/datadome_integration_init.html.twig
View source
  1. sub set_origin_header {
  2. if (req.backend.is_origin) {
  3. if (req.backend == datadome) {
  4. set bereq.http.x-datadome-params:key = "{{ datadome_api_key }}";
  5. set bereq.http.x-datadome-params:requestmodulename = "FastlyMagento";
  6. set bereq.http.x-datadome-params:moduleversion = "2.10";
  7. set bereq.http.x-datadome-params:timerequest = time.start.usec;
  8. set bereq.http.x-datadome-params:servername = server.identity;
  9. set bereq.http.x-datadome-params:serverregion = server.region;
  10. set bereq.http.x-datadome-params:ip = req.http.fastly-client-ip;
  11. set bereq.http.x-datadome-params:authorizationlen = std.strlen(req.http.authorization);
  12. unset bereq.http.authorization;
  13. if (req.http.x-datadome-clientid) {
  14. set bereq.http.x-datadome-params:clientid = urlencode(req.http.x-datadome-clientid);
  15. set bereq.http.x-datadome-x-set-cookie = "true";
  16. } else {
  17. set bereq.http.x-datadome-params:clientid = urlencode(req.http.cookie:datadome);
  18. }
  19. set bereq.http.x-datadome-params:cookieslen = std.strlen(req.http.cookie);
  20. unset bereq.http.cookie;
  21. } else {
  22. # prevent leak of the key
  23. unset bereq.http.x-datadome-params;
  24. }
  25. }
  26. }
  27. backend datadome {
  28. .host = "api-fastly.datadome.co";
  29. .port = "8443";
  30. .connect_timeout = {{ datadome_connect_timeout }}ms;
  31. .first_byte_timeout = {{ datadome_between_bytes_timeout }}ms;
  32. .between_bytes_timeout = {{ datadome_between_bytes_timeout }}ms;
  33. .max_connections = 200;
  34. .ssl = true;
  35. .dynamic = true;
  36. .probe = {
  37. .request = "HEAD /.well-known/healthcheck-datadome HTTP/1.1" "Host: api-fastly.datadome.co" "Connection: close" "User-Agent: Varnish/fastly (healthcheck)";
  38. .expected_response = 200;
  39. .initial = 5;
  40. .interval = 2s;
  41. .threshold = 1;
  42. .timeout = 2s;
  43. .window = 5;
  44. }
  45. }