iOS apple-app-site-association - 它需要离开我服务器的根目录吗?

iOS apple-app-site-association - does it need to be off the root of my server?

我正在尝试为我的 Capacitor 应用程序配置深度 linking,并按照此处的说明进行操作:https://capacitorjs.com/docs/guides/deep-links。 Apple 提到

"The file needs to be accessible via HTTPS—without any redirects—at https:///apple-app-site-association or https:///.well-known/apple-app-site-association. Next, you need to handle universal links in your app"

"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."

https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html


我的问题是:.well-known 目录绝对需要离开我服务器的根目录吗?

我们使用 Google Cloud 和 Kubernetes,我需要 link 的网站不在 domain.com,它在 domain.com/myapp。我需要能够在域中提供 apple-site-association 文件。com/myapp/.well-known/apple-app-site-association.

但是,当我在以下位置提供关联文件时:

domain.com/myapp/.well-known/apple-app-site-association

我得到:

"Error cannot fetch app site association" from https://search.developer.apple.com/appsearch-validation-tool"

我已经在设备上使用我的应用程序进行了深度 linking 测试(只是为了查看验证程序是否有误),但我总是路由到我们的网站而不是我们的应用程序。

是的,.well-known 必须脱离根。它不能在 /myapp 下并且您不能使用重定向。

您可以在站点关联文件中指定一个路径,因此您使用的通用链接可以包含 /myApp 路径。

我的经验是.well-known目录不能修改(其他原因)。我将 apple-app-site-association 直接放在我网站的根目录中,它工作正常。