This repository contains the reproduction of an issue identified with Azure App Service and OpenTelemetry when enabling CORS.
When running an Azure App Service with CORS enabled and an OpenTelemetry enabled .NET 8 application deployed the app will not generate traces to the App Service's Console even when the OpenTelemetry.Exporters.ConsoleExporter
is added.
If the CORS policy is disabled the traces will be generated as expected.
- Clone the repository
- Open
infra/app-service-with-cors.bicep
and modify the resource names to unique values - Create an Azure App Service using the
infra/app-service-with-cors.bicep
- Open
infra/app-service-without-cors.bicep
and modify the resource names to unique values - Create an Azure App Service using the
infra/app-service-without-cors.bicep
- Deploy the
Otel-Azure-PoC
project to both App Services - Access the App Service without CORS enabled on
/WeatherForecast
and check the console logs- Expected: The console log shows traces for the http.route
WeatherForecast
every time the endpoint is accessed
- Expected: The console log shows traces for the http.route
- Access the App Service with CORS enabled on
/WeatherForecast
and check the console logs- Expected: The console log shows no traces for the http.route
WeatherForecast
- Expected: The console log shows no traces for the http.route