# Multiple suffixes for media types

**URL:** <https://discourse.gohugo.io/t/multiple-suffixes-for-media-types/9820>\
**Category:** support\
**Created:** [January 3, 2018, 4:28pm UTC](https://discourse.gohugo.io/t/multiple-suffixes-for-media-types/9820 "2018-01-03T16:28:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucasvandijk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/lucasvandijk/32/4875_2.png) [@lucasvandijk](https://discourse.gohugo.io/u/lucasvandijk)\
**Post date:** [January 3, 2018, 4:28pm UTC](https://discourse.gohugo.io/t/multiple-suffixes-for-media-types/9820/1 "2018-01-03T16:28:17Z")

</div>

Hi,

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’ve found this page: [https://gohugo.io/templates/output-formats/](https://gohugo.io/templates/output-formats/)

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?

Thanks in advance,  
Lucas

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [January 3, 2018, 4:42pm UTC](https://discourse.gohugo.io/t/multiple-suffixes-for-media-types/9820/2 "2018-01-03T16:42:06Z")

</div>

> [@lucasvandijk](#):
>
> Is it possible to configure multiple suffixes for a mime type?

No, but you can define multiple mime types, which I guess is what you want.

---

<div class="post-metadata">

**Author:** ![lucasvandijk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/lucasvandijk/32/4875_2.png) [@lucasvandijk](https://discourse.gohugo.io/u/lucasvandijk)\
**Post date:** [January 3, 2018, 4:45pm UTC](https://discourse.gohugo.io/t/multiple-suffixes-for-media-types/9820/3 "2018-01-03T16:45:50Z")

</div>

I don’t believe so: I would like both .json and .json.gz files to be served with the mimetype application/json. How would I approach that?

Thanks,  
Lucas

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [January 3, 2018, 4:59pm UTC](https://discourse.gohugo.io/t/multiple-suffixes-for-media-types/9820/4 "2018-01-03T16:59:05Z")

</div>

> [@lucasvandijk](#):
>
> I don’t believe so: I would like both .json and .json.gz files to be served with the mimetype application/json. How would I approach that?
> 
> Thanks,
> 
> Lucas

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.

---

<div class="post-metadata">

**Author:** ![lucasvandijk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/lucasvandijk/32/4875_2.png) [@lucasvandijk](https://discourse.gohugo.io/u/lucasvandijk)\
**Post date:** [January 6, 2018, 10:46am UTC](https://discourse.gohugo.io/t/multiple-suffixes-for-media-types/9820/5 "2018-01-06T10:46:28Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [January 6, 2018, 6:36pm UTC](https://discourse.gohugo.io/t/multiple-suffixes-for-media-types/9820/6 "2018-01-06T18:36:14Z")

</div>

> [@lucasvandijk](#):
>
> Alright thanks for your response, and something that sounded like a possible workaround. Unfortunately I cannot use the character “+” in Hugo mediatypes.

Could you create an issue on GitHub and point back to this thread? It should be possible, but it needs some work.

HTTP headers can not be set from a static site.

---

<div class="post-metadata">

**Author:** ![lucasvandijk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/lucasvandijk/32/4875_2.png) [@lucasvandijk](https://discourse.gohugo.io/u/lucasvandijk)\
**Post date:** [January 14, 2018, 7:49pm UTC](https://discourse.gohugo.io/t/multiple-suffixes-for-media-types/9820/7 "2018-01-14T19:49:00Z")

</div>

Yep I will.

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.
