Search code examples
iosdeep-linkingios-universal-linkscapacitorapple-app-site-associate

iOS apple-app-site-association - does it need to be off the root of my server?


I am trying to configure deep linking for my Capacitor App and am following the instructions here: https://capacitorjs.com/docs/guides/deep-links. Apple mentions that

"The file needs to be accessible via HTTPS—without any redirects—at https:///apple-app-site-association or https:///.well-known/apple-app-site-association. Next, you need to handle universal links in your app"

And

"Upload the apple-app-site-association file to your HTTPS web server. You can place the file at the root of your server or in the .well-known subdirectory."

https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html


My questions is: does the .well-known directory absolutely need to be off the root of my server?

We use Google Cloud and Kubernetes and the website I need to link with does not live at domain.com, it lives at domain.com/myapp. I need to be able to serve the apple-site-association file at domain.com/myapp/.well-known/apple-app-site-association.

However, when I serve the association file at:

domain.com/myapp/.well-known/apple-app-site-association

I get:

"Error cannot fetch app site association" from https://search.developer.apple.com/appsearch-validation-tool"

I've tested deep linking with my app on a device (just to see if the validator was wrong) but am always routed to our website and not our application.


Solution

  • Yes, .well-known must be off the root. It can't be under /myapp and you can't use a redirect.

    You can specify a path in the site association file, so the universal links you use can contain the /myApp path.