I want all apache non-error responses to be sent with content-type 'application/json; charset=UTF-8'
. How do I make it?
I've tried adding:
<VirtualHost *:80>
AddType 'application/json; charset=UTF-8'
</VirtualHost>
But this requires specifying file extension, I don't want to bind to file extensions since I'm not requesting specific files, but resources like this:
http://my.domain.com/rest/articles/
I've also tried DefaultType
directive:
<VirtualHost *:80>
DefaultType 'application/json; charset=UTF-8'
</VirtualHost>
but this doesn't seem to be working - Content-Type:text/html; charset=utf-8
is returned. Am I missing something?
DefaultType
directive is "disabled" on Apache 2.4. See this related question for more info: serverfault.com/questions/622096/… – MrWhite Oct 19 '18 at 0:35