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

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 :)

  • 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 at 3: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 at 4:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.