MediaTracker
MediaTracker copied to clipboard
Compability issue with NPMplus and empty Accept-Encoding header
NPMplus sends an empty Accept-Encoding header upstream by default (proxy_set_header Accept-Encoding "";).
This causes runtime errors or incorrect asset delivery in applications that explicitly depend on Accept-Encoding to determine supported compression methods. The javascript and css in particular is getting error 500.
Would it be possible in future releases to add defensive checks defaulting to no compression in the header unless it is necessary.
const encoding = req.header('Accept-Encoding') || '';
if (encoding.includes('br')) {
req.url = req.url + '.br';
setHeaders();
} else if (encoding.includes('gz')) {
req.url = req.url + '.gz';
}