Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

Add support for wildcard domains introduced in iOS 9.3#56

Merged
nikDemyankov merged 3 commits intonordnet:masterfrom
planio-gmbh:wildcard-domains
Jun 10, 2016
Merged

Add support for wildcard domains introduced in iOS 9.3#56
nikDemyankov merged 3 commits intonordnet:masterfrom
planio-gmbh:wildcard-domains

Conversation

@schmidt
Copy link
Copy Markdown
Contributor

@schmidt schmidt commented Apr 4, 2016

Starting with version 9.3, iOS now supports wildcard domains in universal link declarations (see current version of official documentation). This works out of the box with this plugin, i.e. the proper entitlements are created and the os interaction works as expected. The only problem is that no JS event is triggered, since the plugin code cannot identify the proper event name.

The attached changes update the findHostByURL method to match host names using wildcards.

Additionally the changes introduced for #44 are updated to also use the predicate match - this was done to avoid creating a second local var, while predicate matches already support case insensitive matching.

Please note, that Android also supports wildcard subdomains in intent-filter declarations. To make this work UniversalLinksPlugin.findHostByUrl would need to be updated accordingly.

@nikDemyankov
Copy link
Copy Markdown
Member

Great, thanks for the PR!

@schmidt
Copy link
Copy Markdown
Contributor Author

schmidt commented Apr 5, 2016

I have just added the necessary changes for Android. Unfortunately Android/Java doesn't seem to offer a simple glob style matching API, so I had to check the host declaration explicitly for *..

@nikDemyankov
Copy link
Copy Markdown
Member

Thanks! Can you also provide examples for android/ios with the wildcard domains in order to update plugin's documentation?

@schmidt
Copy link
Copy Markdown
Contributor Author

schmidt commented Apr 5, 2016

Sure thing:

    <universal-links>
      <host name="*.users.example.com" scheme="https" event="wildcardusers" />
      <host name="*.example.com" scheme="https" event="wildcardmatch" />
    </universal-links>

Please note, that iOS will look for the apple-app-site-association on https://users.example.com/apple-app-site-association and https://example.com/apple-app-site-association respectively.

Android/Google will try to access the app links file at https://*.users.example.com/.well-known/assetlinks.json and https://*.example.com/.well-known/assetlinks.json respectively. Not sure, how this is working in the background, but I guess, one would need to have a wildcard DNS entry and proper web server configuration which is able to handle asterisks in host headers. But I can confirm, that we actually got these requests to our servers after adding above rules.

@nikDemyankov nikDemyankov added this to the v1.2.0 milestone Apr 5, 2016
@nikDemyankov
Copy link
Copy Markdown
Member

Great, thanks!

@FreakTheMighty
Copy link
Copy Markdown

@schmidt just bumped into this post after having read these docs.

It looks like Apple looks in the root and in .well-known

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.

@corporealshift
Copy link
Copy Markdown

ETA on this getting merged?

@schmidt
Copy link
Copy Markdown
Contributor Author

schmidt commented Jun 10, 2016

@FreakTheMighty Your're right. Apple will look for the files at /apple-app-site-association and /.well-known/apple-app-site-association. But since they are trying /apple-app-site-association first (and only using the other if the first one returns an error), I did not mention it explicitly.

My main intent was to highlight the host names, that are used, and the differences between the ones, that Android and iOS test.

@nikDemyankov nikDemyankov merged commit 4a475f2 into nordnet:master Jun 10, 2016
@nikDemyankov
Copy link
Copy Markdown
Member

Merged. Thanks to @schmidt !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants