-
Notifications
You must be signed in to change notification settings - Fork 240
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
Blocking certain URIs/Patterns from fetch tracking (patch included) #1089
Comments
Does using |
In my use case, I only need to filter a specific URI from a domain I am otherwise including. I may have tested it wrong but it didn't produce the behavior I required. |
Your patch seems to have similar behavior to the correlationHeaderExcludedDomains. It accepts wildcard |
In my AppInsights configuration, I tried the following options:
This still results in correlation headers being sent to that URI.
Am I doing something wrong here? |
I believe you need to include the actual hostnames in the 2 config arrays since we do URL parsing on them during the comparison. e.g. |
I'm sorry, I don't understand how that would get correlation headers to be sent to my API server on all URIs except the one I needed to blacklist. I got this fixed by updating the problematic endpoint to allow the correlation headers. Still, I believe a better mechanism to choose where to send correlation headers would be useful... Perhaps an option like shouldSendCorrelationHeaders whose signature would be |
See the implementation here. The URLs you configure with must include the hostname, and not just the route information. ApplicationInsights-JS/shared/AppInsightsCommon/src/Util.ts Lines 672 to 712 in b3d82fe
|
Reading that implementation, it would appear there is no way to exclude a URL inside a host, since only the host is taken into account in the excludedDomains match. The point was to exclude a single URL. |
Yes it seems to only be looking at the hostname and no route info so I'd consider this shortfall a bug/enhancement 😃 |
Release is now fully deployed |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I have recently run into an issue where I had to block AppInsights from sending correlation headers to a specific URI via fetch. I understand I can stop these URIs from being tracked with a plugin that prevents this information from being sent to the telemetry server, however this doesn't stop fetch from being hooked and the headers from being sent. I couldn't find a documented feature that results in this behavior.
To work around it, I have applied the following patch using yarn patch-package:
https://gist.github.com/ewnavilae/07dd5aa58377db6c9ab6df116467b44f
If enough people value this change I may try to submit a pull request actually implementing this correctly. Is there an already implemented, supported way of doing this?
The text was updated successfully, but these errors were encountered: