15 Apr 2024 03:03 PM
Our problem:
Http errors handle by Dynatrace web application don’t have assigned service so we don’t able to see distributed tracing
State of the matter is:
intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
    if (!window.dtrum) {
        return next.handle(req);
    }
    const xhrActionId: number = window.dtrum?.enterXhrAction(`HTTP ${req.method} request`, 1, req.url);
    return next.handle(req).pipe(
        tap({
            next: (): void => {},
            error: (error: HttpErrorResponse): void => {
                window.dtrum?.markXHRFailed(error.status, error.message, xhrActionId);
            }
        }),
        finalize((): void => {
            window?.dtrum?.leaveXhrAction(xhrActionId);
        })
    );
What did we miss that distributed tracing doesn't work for our RUM application?
Solved! Go to Solution.
19 Apr 2024 02:47 PM
Hi @KamilA 
In certain cases, if you use agentless and if you activate cross-origin, it may be necessary to pass the x-dtc header into CORS in order to be able to link user actions (or errors) to backend traces.
documentation link : https://docs.dynatrace.com/docs/platform-modules/digital-experience/web-applications/initial-setup/l...
23 Apr 2024 08:19 AM
I've configured Access-Control-Allow-Headers: x-dtc header but still x-dtc header isn't set. Should it be added automatically by JavaScript API? Am I right?
23 Apr 2024 08:42 AM
Oui, mais il faut veiller à l'autoriser dans le CORS (peut-être sur API Gateway par exemple).
25 Apr 2024 01:46 PM
But the CORS error will show up only when x-dtc header is added so in my opinion regex in Link cross-origin XHR actions and their distributed traces doesn't work because x-dtc header isn't added
