2

I have a static JSON formatted file called apple-app-site-association sitting at the root of my webapp (e.g. webapp.foo.bar/apple-app-site-association) which is served up via AWS CloudFront.

When I call that file via the URL https://webapp.foo.bar/apple-app-site-association I expect the file to render in my browser, but instead, it is downloaded to my local filesystem.

How do I get CloudFront to see that this file is a JSON file and get it to properly handle it?

1 Answers1

1

Most likely you're not sending the correct Content-Type: application/json header. You'll have to configure the server that serves your application (Apache, Nginx, Tomcat, ...) to do that. For example in Apache you'd use something like this:

AddType application/json json

See https://httpd.apache.org/docs/2.4/mod/mod_mime.html#addtype for more details. Other webservers will have some similar options.

Hope that helps :)

MLu
  • 24,849
  • 5
  • 59
  • 86
  • Thanks for your response. Unfortunately, I am not using any of the webservers you have mentioned. As outlined in the original post, I am serving the content up via AWS CloudFront. – Q. Wade Billings Oct 18 '19 at 03:39
  • @Q.WadeBillings CloudFront is just a frontend CDN for some web server or for S3. There must be some kind of web server behind CloudFront. Check the CF *origin* setting. – MLu Oct 18 '19 at 04:59