Do Universal Links hit my server?

爱⌒轻易说出口 提交于 2019-12-11 06:08:38

问题


I've set up Universal Links on my iOS app using an aliased subdomain of my backend with a scheme like sudomain.mydomain.com. I want users that DON'T have the app installed to be redirected to our page in the App Store rather than hitting some nonexistent endpoint on our server (we don't have a webapp only a mobile backend).

I was thinking about doing something like this:

app.get('*', (request, response) => {

    const domain = request.headers.host,
      subdomain = domain.split('.');

    if ( subdomain[0] === 'subdomain'){
        response.redirect('www.linktoappstore.com');   
    } 
    ...
});

However I don't want this to interfere with Universal Linking for people who DO have the app installed. Are Universal Link get requests sent to my server or does iOS intercept them before that happens?


回答1:


This should work just fine.

When Universal Links are configured and your app is installed, the device does NOT hit the server before launching the app. This is because iOS caches the apple-app-site-association file when the app is initially installed, and if the URL being opened matches a path defined there, Universal Links kick in. In that situation, iOS completely bypasses any web request and immediately launches your app.

Of course, this means you can't track Universal Link traffic, which can become a major pain point. To work around this, you need something like Branch.io (full disclosure: I'm on the Branch team) to fill in the missing data.

Separately, if you're proxying the subdomain, make sure iOS doesn't see that as any sort of redirect. Otherwise the apple-app-site-association file won't be scraped at all (common Universal Link implementation issue).



来源:https://stackoverflow.com/questions/45722140/do-universal-links-hit-my-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!