An Azure service that provides a cloud content delivery network with threat protection.
Hi khj,
Thank you for reaching out on Microsoft Q&A forum.
We came across some of the findings which may be the causes of error & can be verified by your end
AFD Compression Disabled: Since compression is disabled in AFD, it does not add or preserve the Content-Encoding header unless explicitly configured to do so.
Pre-compressed Files with gzip_static: NGINX serves .gz files correctly when gzip_static on is set. However, AFD may strip or fail to forward the Content-Encoding header
It happens because
- The origin uses chunked transfer encoding.
- The request lacks a valid
Accept-Encodingheader. - The file type is not eligible for compression under AFD rules
To ensure .gz files are served with the correct Content-Encoding: gzip header through AFD, we can try some of the fixes below
Enable Compression in AFD
Go to Azure Portal > Front Door > Routes.
Enable compression for the route serving static files.
Wait up to 10 minutes for propagation.
- Use Rules Engine to Preserve Headers
Create a rule to preserve Accept-Encoding and forward Content-Encoding.
Ensure the rule applies to requests with .gz extensions or specific paths like /static/.
- Avoid Chunked Transfer Encoding
Ensure NGINX is not using chunked encoding for .gz files.
Pre-compressed files should have a known Content-Length to avoid chunked responses.
If you find this comment helpful, please “up-vote” for the information provided , this can be beneficial to community members.
Kindly let us know if you have any additional questions
Thanks