Skip to content
CodeOnAir
← All posts

Hosting /.well-known/ files: AASA and assetlinks.json on Vercel, Netlify, Nginx and Cloudflare

The exact config to serve apple-app-site-association and assetlinks.json from /.well-known/ on Vercel, Netlify, Nginx, Cloudflare, Apache, Firebase Hosting and Express, and the gotcha each host has.

CodeOnAir team8 min read

Serve apple-app-site-association (no file extension) and assetlinks.json from /.well-known/ on every domain your app lists. Each must return HTTP 200 over HTTPS with Content-Type: application/json and no redirect. On most hosts that takes one header or rewrite rule, plus two checks: that your build doesn't drop the dot-folder, and that bot protection doesn't challenge Apple's or Google's crawler.

You have a correct apple-app-site-association file and a correct assetlinks.json. Now they need to be served from /.well-known/ on your domain, exactly the way Apple and Google expect, and that's where a surprising number of setups fail: a redirect from the bare domain, a missing content type, or a dot-folder the build quietly dropped.

This guide gives the exact config for the hosts mobile teams use most: Vercel, Netlify, Nginx, Cloudflare, Apache, Firebase Hosting and Express, and the gotcha each one has. If you still need to write the files, start with the apple-app-site-association and assetlinks.json setup guide, or build them with our free AASA and assetlinks.json generator. For copy-paste AASA patterns, see apple-app-site-association examples and common errors.

What every host has to get right

The rules come from Apple's Supporting associated domains and Android's Digital Asset Links guide:

iOS Android
URL https://<host>/.well-known/apple-app-site-association https://<host>/.well-known/assetlinks.json
File extension None .json
Status 200, over HTTPS with a valid certificate 200, over HTTPS with a valid certificate
Redirects Not followed Not followed
Content type application/json application/json
Which hosts Every host in Associated Domains Every host in an autoVerify intent filter

Two of these cause most of the trouble:

  • The AASA file has no extension, so static hosts can't guess its type and often send application/octet-stream. You have to set the header yourself.
  • Every host is checked separately. If your app lists both example.com and www.example.com, both must serve the files directly. A redirect from one to the other, which most hosts add by default, breaks that host.

Before you start: the folder

Put both files in a .well-known folder inside whatever your host publishes:

public/
  .well-known/
    apple-app-site-association
    assetlinks.json

public/ is right for Next.js, Vite, Create React App and most static site generators: they copy it to the output as is. Check the build output (out/, dist/, build/) for the folder after a build. Some tools skip files and folders whose names start with a dot, and you'll see the problem there before your users do.

Vercel

With Next.js or a static site on Vercel, put the files in public/.well-known/ and set the content type for the file without an extension in vercel.json:

{
  "headers": [
    {
      "source": "/.well-known/apple-app-site-association",
      "headers": [{ "key": "Content-Type", "value": "application/json" }]
    }
  ]
}

On Next.js you can set the same header in next.config.js instead, with async headers() returning the same source and header.

The gotcha: the domain redirect. When you add both example.com and www.example.com to a Vercel project, one of them is usually set to redirect to the other. That's fine for your website, but it means the redirecting host can't open your app. Either list only the host that serves the site in your app, or set both domains in the project's domain settings to serve the project without a redirect.

Also keep the files public. Vercel's deployment protection can put a login in front of preview deployments, so test the files on your production domain.

Netlify

Put the files in your publish directory (for example public/.well-known/ with Vite or Create React App), then add a _headers file to the publish directory:

/.well-known/apple-app-site-association
  Content-Type: application/json

Or the same in netlify.toml:

[[headers]]
  for = "/.well-known/apple-app-site-association"
  [headers.values]
    Content-Type = "application/json"

Check the result with curl -sI after you deploy. Netlify's community forum has reports of the content type not changing in some setups. If that happens to you, keep a copy named apple-app-site-association.json and rewrite to it in _redirects, so the response takes that file's JSON type:

/.well-known/apple-app-site-association  /.well-known/apple-app-site-association.json  200

The gotcha: the primary domain. Netlify always redirects between the bare domain and www, towards whichever one you set as primary, and that redirect can't be turned off for the primary domain. So the non-primary one can't open your app. List only the primary host in your app, or use a separate link subdomain such as links.example.com, which Netlify doesn't redirect.

Nginx

Serve the two files with an explicit location each, before any catch-all:

location = /.well-known/apple-app-site-association {
    root /var/www/example;
    default_type application/json;
    try_files $uri =404;
}
location = /.well-known/assetlinks.json {
    root /var/www/example;
    default_type application/json;
    try_files $uri =404;
}

try_files … =404 matters if the server also runs a single-page app: without it, a fallback such as try_files $uri /index.html returns your HTML with a 200, and the "file" isn't JSON.

The gotcha: the redirect server block. A typical setup sends the bare domain to www with return 301. Keep /.well-known/ out of it:

server {
    listen 443 ssl;
    server_name example.com;
    # ssl_certificate … as usual

    location /.well-known/ {
        root /var/www/example;
        default_type application/json;
        try_files $uri =404;
    }
    location / {
        return 301 https://www.example.com$request_uri;
    }
}

People still land on www for every page, and both hosts serve the files directly.

Cloudflare

Cloudflare Pages. Put the files in your build output's .well-known/ folder and add a _headers file to the same output directory, with the same syntax as Netlify's:

/.well-known/apple-app-site-association
  Content-Type: application/json

Per Cloudflare's docs, _headers applies to static assets, not to responses from Pages Functions. If a Function or an SSR framework answers /.well-known/, set the header in that code instead. Workers with static assets read a _headers file in the assets directory the same way.

Cloudflare in front of your own server. This is where Cloudflare causes the most trouble, because the file works in your browser and fails for Apple and Google:

  • Bot protection. Bot Fight Mode, "I'm Under Attack" mode and WAF challenges can serve a challenge page to Apple's CDN or Google's verifier. Add a WAF custom rule that skips security features for requests where the URI path starts with /.well-known/. Note that Cloudflare doesn't let you skip Bot Fight Mode with a rule; if it challenges the fetch, turn it off for that zone or serve the files from a host without it.
  • Redirect rules. A Redirect Rule or Page Rule that sends the bare domain to www breaks the bare domain, as on every other host. Exclude /.well-known/ from it.

Apache

In .htaccess (or your virtual host), set the type for the file without an extension and keep /.well-known/ out of your redirects:

<Files "apple-app-site-association">
  ForceType application/json
</Files>

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/\.well-known/
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^ https://www.example.com%{REQUEST_URI} [R=301,L]

assetlinks.json gets application/json from its extension through Apache's normal MIME types.

Firebase Hosting

The gotcha: dot-files are ignored. The firebase.json that firebase init writes usually includes "**/.*" in ignore, and that pattern drops the whole .well-known folder from the deploy. Remove it, or narrow it, then set the header:

{
  "hosting": {
    "public": "public",
    "ignore": ["firebase.json", "**/node_modules/**"],
    "headers": [
      {
        "source": "/.well-known/apple-app-site-association",
        "headers": [{ "key": "Content-Type", "value": "application/json" }]
      }
    ]
  }
}

Express and other Node servers

express.static can refuse dot-folders: on Express 5 its dotfiles option defaults to ignore, and /.well-known/ returns a 404. Explicit routes work on every version and set the content type too:

const path = require("path");
const wellKnown = path.join(__dirname, "public", ".well-known");

app.get("/.well-known/apple-app-site-association", (req, res) =>
  res.type("application/json").sendFile(path.join(wellKnown, "apple-app-site-association")),
);
app.get("/.well-known/assetlinks.json", (req, res) =>
  res.type("application/json").sendFile(path.join(wellKnown, "assetlinks.json")),
);

Register these before any login middleware or single-page-app fallback.

GitHub Pages: better avoided

GitHub Pages doesn't let you set response headers, so the AASA file is served with whatever type GitHub picks for a file without an extension. Jekyll also skips folders that start with a dot unless you add include: [".well-known"] to _config.yml or a .nojekyll file. Android App Links can work there, since assetlinks.json has an extension. For Universal Links, use another host for the link domain.

Check the result

Run these against every host your app lists:

curl -sI https://example.com/.well-known/apple-app-site-association
curl -sI https://example.com/.well-known/assetlinks.json

You want 200, content-type: application/json and no location: header. Then check what the platforms themselves read:

# Apple's CDN copy (what iOS 14+ devices actually use)
curl -s https://app-site-association.cdn-apple.com/a/v1/example.com

# Google's Digital Asset Links API
curl -s "https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://example.com&relation=delegate_permission/common.handle_all_urls"

Our free Universal Link and App Link validator runs all of this at once, with redirects turned off: status, content type, JSON structure, app IDs and fingerprints, your paths against the AASA rules, Apple's CDN copy and Google's API. When a fix is deployed, the deep link testing guide covers checking it on real devices.

Or don't host them at all

If the domain exists only for links, you can skip all of the above. CodeOnAir AppLinks gives every app a link domain such as yourapp.codeonair.com, or serves your own subdomain with the custom domain add-on, and builds both files from your app settings. They're served with the right type and no redirects, rebuilt when you change your app settings, and checked by the dashboard's App setup box. The AppLink setup guide walks through it. If links still open the browser after that, the Android App Links verification guide and the Universal Links checklist cover the app side.

FAQ

Can I redirect example.com to www and still use Universal Links?

Yes, for every path except /.well-known/. Serve the two files directly on both hosts and redirect everything else. Or list only the host that doesn't redirect in your app.

Does the AASA file have to be served as application/json?

Serve it that way. It's what Apple's documentation and validators expect, and because the file has no extension, many hosts otherwise send application/octet-stream.

Why does my .well-known folder return 404 after deploying?

Usually because a tool dropped or refused the dot-folder: Firebase Hosting's default ignore pattern, Jekyll on GitHub Pages, or express.static's dotfiles setting. Check the build output and the deploy settings.

Do I need the files on every subdomain?

On every host your app lists. example.com, www.example.com and links.example.com are checked separately, each at its own /.well-known/ path.

Can Cloudflare block Apple or Google from reading the files?

Yes. Bot protection and WAF challenges can answer Apple's CDN or Google's verifier with a challenge page instead of the file. Skip security features for /.well-known/ and check the CDN copy and Google's API rather than your browser.


Config checked on 15 November 2026 against Apple's associated domains documentation, Android's Digital Asset Links guide, and Vercel, Netlify, Cloudflare and Firebase Hosting documentation.

Your first AppLink in five minutes.

Create an app, pick a subdomain, and share a link that opens your app. Try Growth free for 30 days — no card needed.