Menu
Grafana Cloud

Proxy RUM data to Frontend Observability

A proxy can be used to:

  • Filter out bots
  • Enrich the signals with custom data
  • Apply advanced filter techniques to prevent sensitive data from being sent to Grafana Cloud
  • Apply advanced sampling techniques to reduce the amount of data sent to Grafana Cloud
  • Apply advanced rate limiting techniques to prevent submitting too many user-sessions to Grafana Cloud
  • Hide the original ingest token into Grafana Cloud to obscure it from clients

Requirements for the proxy

Any proxy technology can be used, as long as it transparently forwards all headers to and from the Grafana Cloud collector endpoint and sets a X-Forwarded-For header to communicate the client IP to the endpoint.

Example (nginx)

An nginx implementation could be as simple as introducing a new location block that handles and forwards to your collector endpoint:

nginx
location ~ ^/faro-proxy(.*)$ {
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Host $http_host;
  proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;

  proxy_ssl_server_name on;
  resolver          8.8.8.8 8.8.4.4 ipv6=off;
  resolver_timeout  5s;

  # customize this line with the hostname of your collector
  set $faro "faro-collector-prod-us-central-0.grafana.net";

  proxy_pass https://$faro/collect$1;
}

In your JavaScript initialization code, you should now be able to use the proxy host instead of the hosted collector and the proxy should reverse-proxy between Grafana Cloud and the users’ browser.

Before: https://faro-collector-prod-us-central-0.grafana.net/collect/12345abcdefg

After: https://my-proxy-host.net/faro-proxy/12345abcdefg

Reading further