Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS deeplink (universal Link) through sub Domain

I have read a lot of articles regarding universal links but still i need to be clear regarding few things.

I have to add universal links to http://www.domain.com but due to certain reasons i will not be able to make my website SSL certified or even put apple-app-site-association with https in root folder. So I thought of doing this in a different way, i will put apple-app-site-association file in the root of a subdomain, lets say https://www.app.domain.com/apple-app-site-association

Then i will open every universal link with that subdomain whenever universal link is available and redirect https://www.app.domain.com to http://www.domain.com if universal link is not available.

Questions in my mind :-
  1. apple says - file needs to be accessible via HTTPS—without any redirects—at https:///apple-app-site-association. In this line what does apple mean by without any redirects ?

  2. when apple does not find any universal link related to a particular URL, will it itself redirects it to safari.

  3. Is this a safe way to add universal links or is it necessary to have our main domain on https or at-least apple-app-site-association on https
like image 476
Sudhanshu Gupta Avatar asked Dec 13 '16 07:12

Sudhanshu Gupta


2 Answers

This should work fine. To explicitly answer your questions:

  1. 'Without redirects' means when iOS requests https://www.app.domain.com/apple-app-site-association, it must find the file at that address. You can't have a redirect of any kind (Javascript, 301, 302, etc)
  2. If a URL is not valid for Universal Links because you didn't cover it using the inclusion rules in the apple-app-site-association file, it will be opened using Safari. If the URL is on another domain without a valid apple-app-site-association file (e.g., http://www.domain.com/), then it will also be opened in Safari.
  3. Yes, it's fine. Definitely a workaround, but not unsafe.

You should also investigate a hosted deep linking service like Branch.io (full disclosure: I'm on the Branch team) or Firebase Dynamic Links. These will give you all of the same benefits (plus a bunch more flexibility, to be honest) without any of the setup headaches.

like image 85
Alex Bauer Avatar answered Sep 21 '22 07:09

Alex Bauer


We experienced ways where a 302 on iOS works. In general I fully agree that Apple officially does not seem to support any redirect. The following cases have been tested on an iPhone 6 running iOS 11.

These cases work :

  • Website in Chrome on iOS: User clicks on link A and a 302 redirects him to a Universal link B.
  • Website in Safari on iOS: User clicks on link A and a 302 redirects him to a Universal link B.
  • Gmail App on iOS: User clicks on link in email and Gmail opens external Chrome browser, which opens a Google link which redirects to link A which redirects via 302 to Universal Link B. (this case works only if Chrome is installed and in Gmail Settings the user explicitly changed the default browser to Chrome)

These cases DO NOT work:

  • Apple Mail: User clicks on link A in email and external Safari is opened. 302 happens and opens Universal link B. Result: App does not open
  • Gmail App: User clicks on link A in email and Gmail inAppBrowser (probably WKWebview?) is opened. Gmail redirects EVERY link from an email over a google server, as a second step link A is opened (dont know via 302 or other method) then 302 happens and opens Universal link B. Result: App does not open

Unfortunately you can see that in some cases it does NOT work. As these cases, Apple Mail and Gmail on iOS are very important for most of us here, I think this is a showstopper and you should not use it.

We tested with Adjust links and therefore in cases where the app does not open Adjust opens the AppStore to download the app.

For all Adjust interested: We tested by opening a link https://app.adjust.com/... which has a 302 on the respective Universal link https://XXXXXXX.adj.st/... on which our app listens.

like image 45
Sorcerer Avatar answered Sep 20 '22 07:09

Sorcerer