Serve Standalone Pre-Compressed Files and Provide Helpful Error Page to Clients Lacking Support #701
Replies: 1 comment
|
@TheDocTrier thanks for the insights. First, I will describe the current SWS behaviour so we can adjust it where necessary or find a solution for the discussion in the thread.
As you said, if we want to serve standalone precompressed files directly regardless of their uncompressed simblings being present. We can introduce a new SWS option that could swap the priority to complement what I suggest a new option like Let me know your thoughts on this. P.D. In the upcoming v3, I plan to make this much clearer and more flexible by improving the
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This discussion is spawning from #617 (comment):
The two web servers I am currently using are
nginxandhttp-server. They both support being able to serve pre-compressed files without needing to keep the uncompressed copies adjacent. In the case ofnginx, the support is explicitly intended as functionality for thegzip_staticdirective:In the case of
http-server, the support is implied by the documentation for the--gzipflag:I recreated minimal examples using both
nginxandhttp-serverto observe their behavior when an appropriateAccept-Encodingheader is not present versus present. Neither use the 415 (Unsupported Media Type) status code, opting instead for 404 (Not Found). Perhaps consequently, neither provide a correspondingAccept-Encodingheader advertising that the resource does in fact exist, but only via a different content encoding. I think the choice to use 404 is ok, but I would prefer 415 and it would be especially helpful if the default 415 error page would indicate to the user the way to resolve the issue, "A web browser or HTTP client which supports Gzip content encoding is required to fetch this resource."Here is using
nginx:Note,
gzip_staticcan conflict with thetry_filesdirective which will take precedence and prevent pre-compressed files from being checked for and served. I accidentally learned this since the default configuration ofnginxin Debian uses a globaltry_filesdirective.Here is using
http-server:Edit: fixed GFM-induced line breaks.
All reactions