- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
The RUM Browser SDK can be configured to send requests through a proxy. When you set the SDK’s proxy
initialization parameter to a URL such as https://www.example-proxy.com/any-endpoint
, all RUM data is sent to that URL using the POST method. The RUM data still needs to be forwarded to Datadog from the proxy.
To successfully forward a request to Datadog, your proxy must
X-Forwarded-For
header containing the request client IP address for accurate geoIP.cookie
header.A Datadog intake URL (example: https://browser-intake-datadoghq.eu/api/v2/rum?ddsource=browser&...
) has three parts:
site
initialization parameter (example: https://browser-intake-datadoghq.eu
)/api/v2/rum
for RUM data or /api/v2/replay
for Session Replay data)ddsource=browser&...
)The Datadog intake origin corresponding to your site
parameter should be defined in your proxy implementation. The path and parameters for each request sent to the proxy can be accessed in the request’s ddforward
parameter (for example, https://www.example-proxy.com/any-endpoint?ddforward=%2Fapi%2Fv2%2Frum%3Fddsource%3Dbrowser
).
The Datadog intake origins for each site are listed below:
Site | Site Parameter | Datadog intake origin |
---|---|---|
US1 | datadoghq.com (default) | https://browser-intake-datadoghq.com |
US3 | us3.datadoghq.com | https://browser-intake-us3-datadoghq.com |
US5 | us5.datadoghq.com | https://browser-intake-us5-datadoghq.com |
EU1 | datadoghq.eu | https://browser-intake-datadoghq.eu |
US1-FED | ddog-gov.com | https://browser-intake-ddog-gov.com |
AP1 | ap1.datadoghq.com | https://browser-intake-ap1-datadoghq.com |
Configure the URL of the proxy in the proxy
initialization parameter. The RUM Browser SDK adds a ddforward
query parameter to all requests to your proxy. This query parameter contains the URL path and parameters that all data must be forwarded to.
import { Datacenter, datadogRum } from '@datadog/browser-rum';
datadogRum.init({
applicationId: '<DATADOG_APPLICATION_ID>',
clientToken: '<DATADOG_CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
proxy: '<YOUR_PROXY_URL>',
});
window.DD_RUM.onReady(function() {
window.DD_RUM.init({
clientToken: '<CLIENT_TOKEN>',
applicationId: '<APPLICATION_ID>',
proxy: '<YOUR_PROXY_URL>',
});
});
window.DD_RUM &&
window.DD_RUM.init({
clientToken: '<CLIENT_TOKEN>',
applicationId: '<APPLICATION_ID>',
proxy: '<YOUR_PROXY_URL>'
});
For example, with a site
set to datadoghq.eu
and a proxy
set to https://example.org/datadog-intake-proxy
, the RUM Browser SDK sends requests to a URL like this: https://example.org/datadog-intake-proxy?ddforward=%2Fapi%2Fv2%2Frum%3Fddsource%3Dbrowser
. The proxy forwards the request to https://browser-intake-datadoghq.eu/api/v2/rum?ddsource=browser
.
From Browser SDK v5.4.0, the proxy
initialization parameter supports a function input. This function allows you to have more control on how the path and parameters are added to the proxy URL.
This function receives an object with the following properties:
path
: the path for the Datadog requests (example: /api/v2/rum
)parameters
: the parameters of the Datadog requests (example: ddsource=browser&...
)Note:
\
escape character to properly propagate these parameters to the browser. For example:proxy: (options) => 'http://proxyURL:proxyPort\${options.path}?\${options.parameters}',
import { Datacenter, datadogRum } from '@datadog/browser-rum';
datadogRum.init({
applicationId: '<DATADOG_APPLICATION_ID>',
clientToken: '<DATADOG_CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
proxy: (options) => `https://www.proxy.com/foo${options.path}/bar?${options.parameters}`,
});
window.DD_RUM.onReady(function() {
window.DD_RUM.init({
clientToken: '<CLIENT_TOKEN>',
applicationId: '<APPLICATION_ID>',
proxy: (options) => `https://www.proxy.com/foo${options.path}/bar?${options.parameters}`,
})
})
window.DD_RUM &&
window.DD_RUM.init({
clientToken: '<CLIENT_TOKEN>',
applicationId: '<APPLICATION_ID>',
proxy: (options) => `https://www.proxy.com/foo${options.path}/bar?${options.parameters}`
});
For example, with a site
set to datadoghq.eu
and the proxy
configuration from the example, the RUM Browser SDK sends requests to an URL that looks this: https://www.proxy.com/foo/api/v2/rum/bar?ddsource=browser
. The proxy will need to forward the request to the URL https://browser-intake-datadoghq.eu/api/v2/rum?ddsource=browser
.
Note:
proxy
function is called for each request, so it should avoid any heavy computation.Before Browser SDK v4.34.0, the proxyUrl
initialization parameter was used, and the Datadog intake origin was included in the ddforward
attribute. The proxy implementation was in charge of validating this host, and failure to do so resulted in various vulnerabilities.
The Datadog intake origin needs to be defined in your proxy implementation to ensure security. If you are still using a proxy with an older version of the Browser SDK, upgrade to a newer version of the Browser SDK to avoid vulnerabilities.
추가 유용한 문서, 링크 및 기사: