Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 406
Peter Avatar asked Jul 17 '12 15:07

Peter


1 Answers

Use the AddType directive in the apache configuration:

AddType application/json .json

like image 187
piksel bitworks Avatar answered Sep 19 '22 05:09

piksel bitworks