# Advanced Configuration

## Customising Integration Triggers

In some cases, there may be a requirement to customise which traffic triggers the Netacea integration within a single Fastly service traffic.

This could be for various reasons, including:

* Multiple domains exist on the same Fastly service, and Netacea protect each domain with a separate set of Datastream models
* Multiple domains exist on the same Fastly service, but Netacea only protect a subset of those domains
* The Netacea Integration needs to be limited to trigger and protect a limited set of pathways
* The Netacea Integration needs to [behave differently](https://docs.netacea.com/overview/integration-modes) based on certain criteria

To support customised triggers, follow the steps outlined below.

{% hint style="warning" %}
Do not complete this configuration without discussing the steps with the Netacea team
{% endhint %}

## Update the Netacea Dictionary

Update the Netacea dictionary configured as part of the standard [Installation and Configuration Guide](https://docs.netacea.com/netacea-plugin-information/fastly). The dictionary must be updated to include the variables and values normally set in the [Netacea\_Config](https://docs.netacea.com/netacea-plugin-information/fastly/installation-and-configuration/..#vcl-snippets) table.

<figure><img src="https://3359534748-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8KQH1bDl0sVMvZgHUjkC%2Fuploads%2Fgit-blob-455fdd905425f46b9ec5c016c24b70d4b51d4a46%2Fimage%20(82).png?alt=media" alt=""><figcaption></figcaption></figure>

The Netacea\_Config table should be set to blank:

<figure><img src="https://3359534748-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8KQH1bDl0sVMvZgHUjkC%2Fuploads%2Fgit-blob-b4d5df0123c9e2ce619e27e1337f2c67a8b3f851%2Fimage%20(80).png?alt=media" alt=""><figcaption></figcaption></figure>

## Update the recv\_configure.vcl

Lastly, the recv\_configure.vcl will need to be updated to include the conditional statements that define how the Netacea integration triggers:

* Cause the integration to trigger on a subset of requests made on the Fastly service.
* Define which Datastream credentials are used when traffic triggers the integration on the Fastly Service.

#### Selective trigger

The following example will cause the integration to trigger on login specific request pathways.

<pre><code>set req.http.x-netacea:edge_config_key_prefix = "";
declare local var.should_run_netacea BOOL;

set var.should_run_netacea = false;

# Must enable Netacea on the following paths if using captcha:
if (!var.should_run_netacea) {
  if (req.url.path ~ "^/AtaVerifyCaptcha|^\/Mitigations\/") {
    set var.should_run_netacea = true;
  }
}

<strong>if (!var.should_run_netacea) {
</strong>  if (req.url.path ~ "\/.*\/(login)\/") {
    set var.should_run_netacea = true;
  }
}

if (var.should_run_netacea) {
  call netacea_check_req;
}
</code></pre>

#### Splitting trigger

The following example will cause the integration to use different Datastream credentials based on the request's associated domain.

```
declare local var.should_run_netacea BOOL;
set var.should_run_netacea = false;

if (req.http.host ~ "example.com") {
  set var.should_run_netacea = true;
  set req.http.x-netacea:edge_config_key_prefix = "dsA_";
}
if (req.http.host ~ "example2.com") {
  set var.should_run_netacea = true;
  set req.http.x-netacea:edge_config_key_prefix = "dsB_";
}
if (var.should_run_netacea) {
  call netacea_check_req;
} 

```

## Update Log Shipping

Lastly, you may need to update your Shipping configuration based on requirements defined by the Netacea Team.
