Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 consider proxy host with custom path request as intake request #550

Merged
merged 1 commit into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function getEndpoint(type: string, conf: TransportConfiguration, source?: string

export function isIntakeRequest(url: string, configuration: Configuration) {
return (
getPathName(url).indexOf('/v1/input/') === 0 &&
getPathName(url).indexOf('/v1/input/') !== -1 &&
(haveSameOrigin(url, configuration.logsEndpoint) ||
haveSameOrigin(url, configuration.rumEndpoint) ||
haveSameOrigin(url, configuration.traceEndpoint) ||
Expand Down
4 changes: 3 additions & 1 deletion packages/core/test/configuration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ describe('configuration', () => {
})

it('should detect proxy intake request', () => {
const configuration = buildConfiguration({ clientToken, proxyHost: 'www.proxy.com' }, usEnv)
let configuration = buildConfiguration({ clientToken, proxyHost: 'www.proxy.com' }, usEnv)
expect(isIntakeRequest('https://www.proxy.com/v1/input/xxx', configuration)).toBe(true)
configuration = buildConfiguration({ clientToken, proxyHost: 'www.proxy.com/custom/path' }, usEnv)
expect(isIntakeRequest('https://www.proxy.com/custom/path/v1/input/xxx', configuration)).toBe(true)
})

it('should not detect request done on the same host as the proxy', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/rum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ The following parameters are available:
| `resourceSampleRate` | Number | No | `100` | The percentage of tracked sessions with resources collection: `100` for all, `0` for none. |
| `sampleRate` | Number | No | `100` | The percentage of sessions to track: `100` for all, `0` for none. Only tracked sessions send rum events. |
| `silentMultipleInit` | Boolean | No | `false` | Initialization fails silently if Datadog's RUM is already initialized on the page. |
| `proxyHost` | String | No | | Optional proxy URL, see the full [proxy setup guide][7] for more information. |
| `proxyHost` | String | No | | Optional proxy host (ex: www.proxy.com), see the full [proxy setup guide][7] for more information. |
| `allowedTracingOrigins` | List | No | | A list of request origins used to inject tracing headers. |

Options that must have matching configuration when also using `logs` SDK:
Expand Down