designcourse
designcourse copied to clipboard
🙏 Need help to setup RUM datadog proxy with NGINX
I am trying to set up proxy for datadog rum events as a lot of them get blocked by ad-blockers and browsers like brave
I have gone through the documentation at https://docs.datadoghq.com/real_user_monitoring/guide/proxy-rum-data/?tab=npm#proxy-setup and still failing to set up the proxy in my nginx.conf below -
location /rum-logs/v2/ {
if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Methods "GET, PUT, POST, DELETE, OPTIONS";
add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With";
add_header Access-Control-Allow-Credentials "true";
add_header Content-Length 0;
add_header Content-Type text/plain;
return 204;
}
rewrite ^/rum-logs/(.*) /$1 break;
proxy_redirect off;
proxy_ssl_session_reuse off;
proxy_ssl_server_name on;
proxy_set_header Host datadoghq.com;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
set $datadog_url "https://browser-intake-datadoghq.com";
set $proxy_pass_url "${datadog_url}${arg_ddforward}";
proxy_pass $proxy_pass_url;
}
When I try to print the ${arg_ddforward} in my nginx logs, I can see the URL, but $proxy_pass_url is always an empty string
Can someone help with this? Is some decoding needed? Or any other way to achieve this?
Hello @vedansh-kapoor,
The best way for us to help you on that front is to reach out to the support.
@amortemousque Support was not very helpful, redirected me to this https://github.com/DataDog/browser-sdk/issues/2471#issuecomment-1857997007 , which did not work in my case. Still getting HTTP 426 errors
https://github.com/DataDog/browser-sdk/issues/2471#issuecomment-1857997007 is roughly how we do it and works good
Still getting HTTP 426 errors
You may be missing this line:
proxy_http_version 1.1;
Nginx proxy will default to http 1.0
For anyone frustrated with Datadog Support not extending their assistance, I’m happy to share my source code as a reference to help. Simple Frontend App: https://github.com/garylparas/simple-react-app-with-dd-rum NginxReverseProxy: https://github.com/garylparas/dd-rum-nginx-proxy
Hello @vedansh-kapoor , Sorry to hear the support wasn’t helpful. Are you still having issues with your proxy setup?
For context, supporting a ready-made proxy setup is challenging due to the wide variety of proxy solutions and customer-specific configurations. We provide the ability to use your own proxy with the Datadog Browser SDK, but we don’t supply a proxy solution ourselves. We’re tracking the need for providing proxy configuration support in our backlog, though we don’t have an ETA yet.