由于Adobe Commerce中的只读根目录,Apple支付域验证失败

在Managed Services上的Adobe Commerce中,Apple支付域验证失败,因为根级别.well-known目录受限制且不可写。 要解决此问题,请将验证文件托管在可写目录中,并使用.magento.app.yaml文件或Fastly VCL代码段配置路由。

描述 description

环境

  • 产品:Managed Services上的Adobe Commerce
  • 版本:2.4.x
  • 受影响的环境:生产、暂存

问题/症状

  • 由于无法写入根目录,因此无法验证Apple支付域。
  • 根目录是只读的。
  • 根据Apple的要求,不允许重定向301次。

解决方法 resolution

要成功放置所需文件并配置它以进行Apple Pay域验证,请执行以下步骤:

  1. .well-known下创建一个/pub/media/目录。
  2. 从Apple Pay下载apple-developer-merchantid-domain-association.txt文件。
  3. 将文件上载到/pub/media/.well-known/

然后,使用以下方法之一配置路由:

方法1:使用.magento.app.yaml

  • 将以下配置添加到您的.magento.app.yaml文件:

    code language-none
    "/.well-known":
      root: "pub/media/.well-known"
      allow: true
      scripts: false
      expires: 1y
    
  • 将更改推送到环境。

方法2:使用Fastly VCL代码片段

  • 登录到Magento Admin,然后转到:商店 > 配置 > 高级 > 系统

  • 展开 全页缓存,然后转到 Fastly配置 >   自定义VCL代码片段

  • 单击 创建,然后添加以下规则:

    code language-none
    if (req.url.path == "/.well-known/apple-app-site-association") {
      set req.url = "/media/.well-known/apple-app-site-association";
    }
    
  • 使用友好名称,如Apple_domain_association

  • 将类型设置为recv并将优先级设置为100

  • 单击 创建,然后单击 上传Fastly VCL 以应用更改。

现在,您应该能够在以下位置访问文件:
https://your_domain/.well-known/apple-developer-merchantid-domain-association.txt

相关阅读

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f