Unable to set JSON header / MIME type

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Unable to set JSON header / MIME type

Postby lucash » 05. June 2019 21:59

Hi all,

I have a new install of the latest XAMPP directly from the official site. I'm working on this project where a site will load some data from a JSON file. When I run the site off localhost, the data doesn't load and I get an "XML parsing" error in console.

This exact site works on a production server, as well as on MAMP on a different device, so I know it's not an issue with the site's code.

I did some digging and found some suggestions that Apache may need to have its config modified in order to default to serving .json files as application/json. However, I've not been able to get it to work and so I'm asking for your help! Here's what I've tried so far:
  • `AddType application/json .json` in /opt/lampp/etc/httpd.conf
  • `AddType application/json .json` in /opt/lampp/apache2/conf/httpd.conf
  • `AddType application/json .json` in .htaccess in htdocs/
  • `application/json json` in /opt/lampp/etc/mime.types

I'm still getting the same error in the browser console, no change at all. Before you ask: yes, I have restarted Apache on every change!

If anyone has any more ideas, I would be glad to try anything out.
Posts: 1
Joined: 05. June 2019 20:45
XAMPP version: 7.3.5-1
Operating System: Pop_OS 19.04

Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 15 guests