Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using gzip_types/ssi_types in NGINX with "wildcard" media types

Tags:

nginx

We have an application, serving json with media type: application/vnd.example.v1.0+json and application/vnd.example.v2.0+json and so on.

If we want to use nginx's http://nginx.org/en/docs/http/ngx_http_ssi_module.html#ssi_types and http://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_types. Do we have to append every possible version number or is there something like a wildcard?

Instead of:

gzip_types "application/vnd.example.v1.0+json" "application/vnd.example.v2.0+json" "application/vnd.example.v3.0+json"

is something like

gzip_types "application/vnd.example*+json"

possible?

like image 785
DracoBlue Avatar asked Oct 31 '22 12:10

DracoBlue


1 Answers

According to NGINX source code src/http/ngx_http.c:

if (value[i].len == 1 && value[i].data[0] == '*') {

No, you can't

like image 166
youfu Avatar answered Nov 08 '22 08:11

youfu