← Back to list

How to prevent the browser from downloading your apple-app-site-association file

Overview

Aremu Oluwagbamila (SMOG) · 2026-05-26 16:59 · 11 claps · 1.6 min read
#ios #universal-links #cloudflare #nuxtjs #nextjs
Open on Medium ↗
Wiki topics: 🌐 · Web Development 🔒 · Cybersecurity

How to prevent the browser from downloading your apple-app-site-association file

Overview

Setting up apple-app-site-association is a critical step in creating a 2-way association between your iOS app and website in order to setup univeral links for your iOS apps. However, a recurring problem with most websites or static hosting platforms is that, because the apple-app-site-association is simply a file without an extension, even though its content is valid JSON, most browsers don’t know how to handle this and simply stream the file back to the browser for a download.

The Fix

The solution I reached out for to resolve this in my case was to use Cloudflare to modify the response header for the apple-app-site-association file. This was easy because I already managed my DNS with Cloudflare, so all I needed to do was simply proxy the website through Cloudflare and set up a rule to update the header of the path to content-type: application/json.

Setting Up Page Rules

  1. Click on the Rules Section and Click on Overview

  1. Click on Create Rule

  1. Click on Response Header Transform Rule

  2. Give the rule a name, select Custom filter expression and provide the full URI of the apple-app-site-association

  1. Click on Set static and set the value of the content-type to application/json , save it and visit the URL, and the route should now render as JSON

메타데이터
post_id
45b28ee111b6
slug
how-to-prevent-the-browser-from-downloading-your-apple-app-site-association-file-45b28ee111b6
url
https://medium.com/@aremusmog/how-to-prevent-the-browser-from-downloading-your-apple-app-site-association-file-45b28ee111b6
canonical_url
https://medium.com/@aremusmog/how-to-prevent-the-browser-from-downloading-your-apple-app-site-association-file-45b28ee111b6
author_url
https://medium.com/@aremusmog
status
ok
fetched_at
2026-07-13 06:23:13