苹果应用网站关联文件没有从服务器获取,而是在苹果设备上缓存了?

52
我们已经使用通用链接很长时间了。今天我添加了一个路径到AASA文件中(我们称之为sub2)。即使重新安装应用程序,该路径也无法被应用程序识别。
当我进行调试时,我注意到应用链接服务正在获取该文件,但请求没有进入我们的服务器。该服务确实获得了旧的AASA文件,因此似乎苹果的CDN正在缓存此文件。
调试:
  • AASA file is valid: tested with Branch Validator as well as the new URL in Apple's appsearch-validation-tool

    {
        "applinks": {
            "apps": [],
            "details": [
                {
                    "appID": "redacted",
                    "paths": [
                        "/main/*",
                        "/sub1/*",
                        "/sub2/*",
                        "/pagex-*"
                    ]
                }
            ]
        },
        "activitycontinuation": {
            "apps": [
                "redacted"
            ]
        }
    }
    
    Apple tool: tested https://redacteddomain/sub2/something
    Link to Application: Passed
    Universal true
    ...
    
  • File is not cached at our side/Cloudflare: above validators confirm this but to be sure I also purged the cache

  • Iphone console shows the AASA file is being fetched:

    Beginning data task AASA-64DCD3xx-xxxxx { domain: xx….xx, bytes: 0, route: cdn }

  • Created a sysdiagnose file on the Iphone, it show the AASA file is fetched at this very timestamp but the contents is the old content:

    Service:              applinks
    App ID:               (redacted)
    App Version:          2.3.4
    App PI:               <LSPersistentIdentifier 0x101579cc0> { v = 0, t = 0x8, u = 0x11c0, db = 49C449xx-xxxx, {length = 8, bytes = 0xc011000000000000} }
    Domain:               (redacted)
    Patterns:             {"/":"/main/*"}, {"/":"/sub1/*"}, {"/":"/pagex*"}
    User Approval:        unspecified
    Site/Fmwk Approval:   approved
    Flags:                
    Last Checked:         2021-07-13 18:45:00 +0000
    Next Check:           2021-07-18 18:36:18 +0000
    
苹果是否有效地缓存了该文件,这是因为我们提供了错误的缓存标头吗?如何测试他们的CDN,这些网址是公开的还是可以在日志中找到它们?有没有办法强制在他们那边清除缓存?
更新:发现我们可以直接使用以下URL查询CDN:https://app-site-association.cdn-apple.com/a/v1/yourdomain.com => 此请求返回旧文件,而原始文件(如Apple-From标头中所述)更新了!根据Age标头,文件只有几分钟的历史。
更新2:问题终于解决了,我只能猜测CDN缓存现在已经刷新。我确保我们的服务器现在发送一个Cache-Control: no-store标头,看起来这使得苹果CDN现在将其缓存一小时(max-age: 3600),但在那个小时后它会被有效地刷新。
请注意,在突然出现的解决方案之前,CDN返回的文件年龄只有几分钟,最大年龄为1800,所以我仍然不太清楚为什么在服务器文件更新后40个小时它仍然没有提供新内容。
至少对于未来遇到类似问题的人来说,CDN URL是调试的很好的起点:https://app-site-association.cdn-apple.com/a/v1/yourdomain.com

3
请点击以下链接观看视频:https://developer.apple.com/videos/play/wwdc2020/10098/?time=879 - undefined
1
谢谢 @matt,这回答了我的第一个问题。由于问题仍然存在,其他问题仍然存在.. 这个缓存会持续多长时间,如何检查、防止和更新。 - undefined
8
CDN 每 24 小时检查您的服务器,设备每周检查 CDN。https://developer.apple.com/documentation/xcode/supporting-associated-domains - undefined
2
这个URL:https://app-site-association.cdn-apple.com/a/v1/yourdomain.com 似乎没有返回任何内容,只是一个空白屏幕。 - undefined
1
我弄明白了 :) 但是屏幕仍然显示空白。但实际上这意味着CDN无法访问该域名下的AASA文件,所以这仍然是一个很好的测试。在我的情况下,网站访问受到地理限制,一旦管理员解决了这个问题,URL就能正常工作并返回文件。 - undefined
显示剩余7条评论
2个回答

1
在这种情况下,您可以在定义应用程序的关联域权利时使用“开发者”备用模式。开发者备用模式绕过CDN缓存,直接访问您的服务器以进行应用程序关联。
为此,将查询字符串添加到关联域权利中: <service>:<完全合格的域名>?mode=developer 这将放在“关联域”功能中,可以通过XCode访问。在文档中了解更多信息:向您的应用程序添加功能

-3

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接