Deprecated: Assigning the return value of new by reference is deprecated in /f2/joshgourneau/public/blog/wp-settings.php on line 520

Deprecated: Assigning the return value of new by reference is deprecated in /f2/joshgourneau/public/blog/wp-settings.php on line 535

Deprecated: Assigning the return value of new by reference is deprecated in /f2/joshgourneau/public/blog/wp-settings.php on line 542

Deprecated: Assigning the return value of new by reference is deprecated in /f2/joshgourneau/public/blog/wp-settings.php on line 578

Deprecated: Function set_magic_quotes_runtime() is deprecated in /f2/joshgourneau/public/blog/wp-settings.php on line 18
Serve .json as content type application/json with Apache on Ubuntu - Joshua Gourneau

Serve .json as content type application/json with Apache on Ubuntu

16/11/2010

If you are using Ubuntu 10.04 or Debian and you serve .json files through Apache, you might want to serve the files with the correct content type. I am doing this primarily because I want to use the Firefox extension JSONView

The Apache module mod_mine will help to do this easily. However, with Ubuntu you need to edit the file /etc/mime.types and add the line

application/json json

Then restart Apache

sudo /etc/init.d/apache2 restart

There are 2 comments in this article:

  1. 3/08/2011Rob McCardle say:

    Bingo, thanks man :)

  2. 30/04/2012Node.js require() for your browser | Pixels vs. Bytes say:

    [...] is responsible for sending the right handler, so you might have to some configuration stuff here. Joshua Gourneau’s post on how add a JSON type to an Apache/Ubuntu server might be a good hint here (it’s easy [...]

Write a comment: