简体   繁体   中英

Returning application/json content-type for .json files on RHEL/Apache

OS is specifically RHEL6 running Apache2.

So in my Apache configuration, I have:

LoadModule mime_module modules/mod_mime.so

And in /etc/mime.types , I have the following:

application/json                                json

Yet when requesting a file with the .json extension (and containing valid JSON), the content-type is set to text/html . Any idea how I can force the correct header for this file type?

Use the AddType directive in the apache configuration:

AddType application/json .json

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM