We have a scenario where we would like to know if users have requested a compressed payload to be returned from our .Net Core API i.e. they have sent a request with the Accept-Encoding header.
Our .Net Core API middleware currently logs the Accept-Encoding request header and Content-Encoding response header to Application Insights.
When a call is made to our API without an Accept-Encoding request header being specified, it looks like Traefik is internally adding the request header as when the request reaches our API, we are logging gzip as the Accept-Encoding header value and can see that gzip is also being logged as the Content-Encoding header value. When the response gets returned back to the client, the Content-Encoding response header is not returned and the payload is uncompressed.
This currently gives us a problem to be able to differentiate when requests have been made to our service without compression (short of logging something on the client side) as there seems to be some internal implicit behavior going on within Traefik.
If I send a curl request directly to the IP of the container with our .Net Core API, I can see that we do not have any logged values for the Accept-Encoding and Content-Encoding header values as is expected.
I've attached a workflow diagram of the current behavior we are experiencing.