CORS in OTLP HTTP Receiver
Enabling CORS (Cross-Origin Resource Sharing) in OTLP (OpenTelemetry Protocol) HTTP receiver is necessary when we want to send requests to our OTLP HTTP receiver from a different domain using browsers. Without enabling CORS, browsers will block these requests for security reasons.
By default, SigNoz does not enable CORS for OTLP HTTP receiver, which means it will block all requests sent via browsers due to security reasons. To change that, we will have to alter the CORS configurations in the OTLP HTTP receiver.
Enable CORS in OTLP HTTP Receiver
To enable CORS, there are mainly three steps involved:
Open SigNoz OtelCollector configuration and locate
httpreceiver section. It should look similar to the following:
Add the CORS configuration under
- https://netflix.com # URL of your Frontend application
Update the above example origin i.e.
https://netflix.comwith your frontend application URL. If you are experimenting on your local machine on port
3000, you can use
To allow any origin to make requests, you can use
*wildcard character instead. However, it is not recommended to set allow all origins due to security risks.
Save the updated configurations and restart SigNoz OtelCollector.
In case of docker, update
otel-collector.yaml to include CORS configuration
deploy/docker/clickhouse-setup folder as instructed above.
Followed by clean removal of SigNoz OtelCollector to guarantee updatation of
configuration and restart the SigNoz OtelCollector using
# clean remove SigNoz OtelCollector
docker stop clickhouse-setup-otel-collector-1
docker rm clickhouse-setup-otel-collector-1
# restart SigNoz OtelCollector using `docker-compose`
docker-compose -f docker/clickhouse-setup/docker-compose.yaml up -d
In case of helm charts, copy the
otelCollector.config section from
override-values.yaml and include CORS configuration under
helm upgrade command below to restart OtelCollector:
helm upgrade --namespace platform my-release signoz/signoz -f override-values.yaml
If you have any feedback or facing issues, feel free to join our slack community to get help!