Observe "Could not inject distributed tracing header to the request origin ('http://local.testrum.com:8106') from the current origin ('http://local.testrum.com:3000')

Trying out Elastic APM for distributed tracing with a react front end (http://local.testrum.com:3000) served by springboot backend (http://local.testrum.com:8106)

Observe the following
Could not inject distributed tracing header to the request origin ('http://local.testrum.com:8106') from the current origin ('http://local.testrum.com:3000')

React configuration

<script src="http://local.testrum.com:3000/elastic-apm-rum.umd.js" crossorigin></script>

  <script>

    elasticApm.init({

      serviceName: 'reactapp',

      logLevel: 'debug',

      serverUrl: 'http://local.testrum.com:8200',

      distributedTracing:true,

      distributedTracingOrigins: ['http://local.testrum.com']

    })

  </script>

APM Server

rum:
    enabled: true

Please advice

Able to get it working but updating the below conf. Now sure why it works but works fine.

distributedTracingOrigins: ['http://local.testrum.com:3000','http://local.testrum.com:8106']

Glad you figured out. Yes the users would need to add the remote host to the distributedTracingOrigins as the agent would add traceparent header to all the outgoing requests which might end up in CORS issue if the users aren't aware of the action they are performing.

Thanks,
Vignesh

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.