Search code examples
iossubdomainapplinks

iOS universal links (applinks) not working for subdomains


Having an issue filtering allowed subdomains for my app's universal links.

Let's say i have those domains:

 - a.subdomain.domain.com 
 - b.subdomain.domain.com 
 - c.subdomain.domain.com

I want my app to be opened by a.subdomain.domain.com and b.subdomain.domain.com but not c.subdomain.domain.com.

As i understood it's not possible to exclude a subdomain in the association file hosted on the server, only path for that domain (with the "NOT /xxx/" in paths).

So went with the choice of allowing a list of subdomains instead of excluding one.

But it doesn't work as expected..

I uploaded association file on both a.subdomain.domain.com and b.subdomain.domain.com. Even on subdomain.domain.com. AASA file contains "paths": ["*"]

In my app entitlements i specified "applinks:a.subdomain.domain.com" and "applinks:b.subdomain.domain.com"

Doesn't open anything. Feels like when i'm adding more than the domain itself in the entitlements it stops working completely.

"applinks:*.domain.com" is fine but opens all the subdomains.

"applinks:a.subdomain.domain.com", "applinks:*a.subdomain.domain.com" or even "applinks:*.subdomain.domain.com" breaks everything.

An i missing something? Haven't found anything about subdomain not being allowed in entitlements, the way it's explained in the official Apple doc it should be working...


Solution

  • I guess no one have interest in that, so i will answer myself after finding out the way, maybe it will be useful to someone else later.

    The association file have to be present on both subdomain.domain.com and domain.com for "applinks:*.subdomain.domain.com" to be working.

    If you want to limit to "applinks:a.subdomain.domain.com" and "applinks:b.subdomain.domain.com", the file have to ALSO be present in a.subdomain.domain.com and b.subdomain.domain.com or any other subdomain you will explicitly specify in the app entitlements.

    Very poorly documented by apple for such an important feature.