Closed gajus closed 7 years ago
Non-issue. http://stackoverflow.com/a/42602984/368691
Turns out I did not read the documentation properly:
Set file extension fallbacks. When set, if a file is not found, the given extensions will be added to the file name and search for. The first that exists will be served. Example: ['html', 'htm'].
i.e. serve-static
does not attempt to see if gz
file exists first; it fallbacks to .gz
if the original file does not exist.
What I'd like is:
If client-sends a request with header Accept-Encoding:gzip, deflate, sdch, br
, I'd like serve-static
to try load files specific to those encodings, e.g.
serveStatic(..., {
tryEncoding: {
br: '.br'
}
});
This configuration would make serve-static
first try serve requested-file.js.br
and then fallback to requested-file.js
.
Looks like there is an extension of serve-static
that enables this functionality.
Appears that this is WIP https://github.com/pillarjs/send/pull/108
(The PR is held because of https://github.com/jshttp/negotiator/pull/49.)
Repost: http://stackoverflow.com/questions/42602053/how-to-try-a-file-and-fallback-to-another-file