Peter Peter - 6 months ago 74
JSON Question

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/

And in
, I have the following:

application/json json

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

Answer Source

Use the AddType directive in the apache configuration:

AddType application/json .json

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download