I have few relatively large datasets as gzipped JSON files, with extension .json.gz. The hugo development server serves these files with the application/x-gzip MIME type. But, I would like them to be served as application/json files, because then the browser will automatically decompress them and consider them as normal JSON files. This plays more nicely with jQuery AJAX calls etc.
I could set the suffix of “application/json” to .json.gz, but it it seems like it will override the setting for normal .json files. Is it possible to configure multiple suffixes for a mime type?
I’m not sure if this is possible to define in Hugo (it should be …), but the JSON MIME type is basically
application/json+json
Where the last part is the suffix.
So application/json+js would still be the same MIME type application/json, but with a different suffix. But as I said, thinking about it I think there is a limitation in Hugo on this.
Alright thanks for your response, and something that sounded like a possible workaround. Unfortunately I cannot use the character “+” in Hugo mediatypes.
A feature that would be really awesome is if you could modify the HTTP headers that get sent for certain paths (using wildcards).
Regarding the last point, I meant adding a configuration section to config.toml that allows you to specify what kind of headers are sent by the builtin hugo server for certain paths.