Background: Pre-compression of static resources, and Object Storage.
The issue I am facing is that DigitalOcean Object Storage allows uploading pre-compressed files and set a custom Content-Encoding header. User can upload multiple versions of static files, that can be brotli compressed, gzipped and raw.
The idea is that I want to rewrite/redirect it (without issuing a 301/302/307 response) to a different static URL based on Accept-Encoding capabilities of the User-Agent (or this can be generalized to allow the APP user to match any criteria, i.e User-Agent string).
If User Agent accepts brotli compression based on Accept-Encoding header, internally rewrite/redirect it to (without issuing a 301/302/307 response):
https://domain.com/static/css/styles.css.br
Background: Pre-compression of static resources, and Object Storage.
The issue I am facing is that DigitalOcean Object Storage allows uploading pre-compressed files and set a custom Content-Encoding header. User can upload multiple versions of static files, that can be brotli compressed, gzipped and raw.
The idea is that I want to rewrite/redirect it (without issuing a 301/302/307 response) to a different static URL based on Accept-Encoding capabilities of the User-Agent (or this can be generalized to allow the APP user to match any criteria, i.e User-Agent string).
For example, the default URL will be like: https://domain.com/static/css/styles.css
If User Agent accepts brotli compression based on Accept-Encoding header, internally rewrite/redirect it to (without issuing a 301/302/307 response): https://domain.com/static/css/styles.css.br
However, if brotli is not supported, but the browser accepts gzip, internally rewrite it to gzip precompressed file: https://domain.com/static/css/styles.css.gz
Thanks.