In an iOS app I am working on I have setup Associated Domains (Universal Links). The app hosts multiple domains. Some domains I have set up with a wildcard. These domains do not seem to work. For example, I want to link to https://news.mydomain.com/
.
If I add the following to the list of associated domains:
applinks:*.mydomain.com
-> Does not work
applinks:news.mydomain.com
-> works fine
So I believe I did set up all correct, the apple-app-site-association file is setup fine. I can even see in both cases (using Charles Proxy) the apple-app-site-association file got retrieved ok.
In the case of the wildcard, the link only opens in Safari.
When I configure the domain without a wildcard, the App opens.
Am I missing something here? I am running iOS 9.3.2 on the device and I am running Xcode 7.3.1 which are today the latest versions.
I added my findings to this thread: https://forums.developer.apple.com/thread/47315
In short, even in iOS 10, it appears that the wildcard setup requires that the apple-app-site-association
file be served by the wildcard's root.
For instance, if you want to use *.domain.com
, then the apple-app-site-association
needs to be hosted at both, e.g., app1.domain.com
and domain.com
, else it won't work with simply specifying applinks:*.domain.com
in Xcode.
This is unfortunate if your main site is hosted at www.domain.com
, and that you have a 301 redirect on domain.com
(which redirects you to www.domain.com
), because Universal Links do not allow redirects.
The workaround I found was to create a main subdomain for your app, and to use sub-subdomains for the wildcard. E.g.
app.domain.com
(must serve the apple-app-site-association
file)server1.app.domain.com
(must serve the apple-app-site-association
)server2.app.domain.com
(...)That way, in Xcode, you may only specify applinks:*.app.domain.com
and Universal Links will work without you having to specify server1.app.domain.com
, server2.app.domain.com
, and so on... in Xcode.
Note, however, that you must also explicitly specify applinks:app.domain.com
if you plan on using that server as well with your app.
I hope this helps.