Skip to content

🙏 Need help to setup RUM datadog proxy with NGINX #3111

Open
@vedansh-kapoor

Description

@vedansh-kapoor

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions