Proxying requests

One of SDK objectives is to proxy requests to Finteza via your website. For details on SDK, please visit the "Proxying the script and requests" section.

To create a proxy middleware for all Finteza analytical queries, use the createProxyMiddleware function:

const path = require("path");
const express = require("express");
const finteza = require("finteza-sdk");
 
const app = express();
 
app.use(
  finteza.createProxyMiddleware({
    token: "lopvkgcafvwoprrxlopvkgcafvwfzsrx",
    path: "/fz/"
  })
); 
 
app.listen(8080);

The middleware independently routes incoming requests and only proxies analytical requests to Finteza.

Set the following parameters for the createProxyMiddleware function:

Parameter

Type

Description

path *

string

Beginning of the path for requests to be proxied (here it is /fz/; if this path is already occupied, use another one).

 

Below are the necessary changes to the tracking code, so that all requests to Finteza are executed along the paths with the specified beginning.

token *

string

Token for signing the X-Forwarded-For header. You can get this value in the website settings of the Finteza panel: open the Counter section, enable the "Proxying the script and requests" option and copy the value from the "Proxy token" field.

 

When proxying, all requests to Finteza are physically sent from your website's server rather than directly from clients. In order to pass real IP addresses of clients (and not just the site address) to Finteza, SDK uses the X-Forwarded-For header.

 

In order to prevent traffic inflation by spoofing requests and provide only real data on website visits, Finteza checks a header signature in requests. If a header is signed by the unique website token, the system trusts its values. Otherwise, the traffic is considered "inflated" (traffic reports are available in the Quality website section of the Finteza panel).

url

string

Finteza server address. In most cases, it should not be changed.

timeout

number

Timeout for proxying requests. Default is 15 000 ms.

* – required parameters.

Note: Change the tracking code after configuring proxying.