Hello! On Fri, Jul 16, 2021 at 08:38:39AM +0200, Marcel Kočíšek wrote:
> Stack overflow: > > https://stackoverflow.com/questions/68362629/nginx-is-sending-for-json-file-text-html-conent-type > > I have problem with my nginx server in version nginx:1.19-alpine running on > Docker. > > Static files with .json extension are served with mime type text/html. > Request: > > curl 'example.json' -H 'Accept: application/json' -H 'Accept-Language: > en-US,en;q=0.5' --compressed -H 'Referer: http://192.168.16.201/' -H > 'X-Requested-With: XMLHttpRequest' > > Response: > > HTTP/1.1 200 OKServer: nginxDate: Tue, 13 Jul 2021 12:23:51 > GMTContent-Type: text/html;charset=utf-8Content-Length: > 14746Connection: keep-aliveContent-Encoding: gzipCache-Control: > no-storeAccept-Ranges: bytesVary: OriginVary: > Access-Control-Request-MethodVary: > Access-Control-Request-HeadersLast-Modified: Thu, 01 Jan 1970 00:00:01 > GMT > > mime.types are configured correctly. Two possible answers I can think of: 1. The MIME types aren't configured correctly. Check your nginx configuration, notably if the "mime.types" is actually included in the configuration and not overwritten at different levels with something like "types {}" (see http://nginx.org/r/types). Just in case, the "nginx -T" output might be helpful to see actual nginx configuration. 2. The response is returned by a backend server rather than nginx. Various "Vary" headers as well as no space before "charset=" in the "Content-Type" suggest this might be the case. Hope this helps. -- Maxim Dounin http://mdounin.ru/ _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx