Apple Pay domain verification fails due to read-only root directory in Adobe Commerce
In Adobe Commerce on Managed Services, Apple Pay domain verification fails because the root-level .well-known directory is restricted and not writable. To fix this, host the verification file in a writable directory and configure routing using either the .magento.app.yaml file or Fastly VCL snippets.
Description description
Environment
- Product: Adobe Commerce on Managed Services
- Version: 2.4.x
- Affected Environment: Production, Staging
Issue/Symptoms
- Unable to verify Apple Pay domain due to inability to write to the root directory.
- The root directory is read-only.
- 301 redirects are not allowed as per Apple’s requirements.
Resolution resolution
To successfully place the required file and configure it for Apple Pay domain verification, follow these steps:
- Create a
.well-knowndirectory under/pub/media/. - Download the
apple-developer-merchantid-domain-association.txtfile from Apple Pay. - Upload the file to
/pub/media/.well-known/.
Then, configure routing using one of the following methods:
Method 1: Using .magento.app.yaml
-
Add the following configuration to your
.magento.app.yamlfile:code language-none "/.well-known": root: "pub/media/.well-known" allow: true scripts: false expires: 1y -
Push the changes to your environment.
Method 2: Using Fastly VCL Snippets
-
Log in to Magento Admin and go to: Stores
>Configurations>ADVANCED>System -
Expand Full Page Cache, then go to Fastly Configuration
>Custom VCL Snippets. -
Click Create, and add the following rule:
code language-none if (req.url.path == "/.well-known/apple-app-site-association") { set req.url = "/media/.well-known/apple-app-site-association"; } -
Use a friendly name like
Apple_domain_association. -
Set the type to
recvand priority to100. -
Click Create, then click Upload Fastly VCL to apply the changes.
You should now be able to access the file at:https://your_domain/.well-known/apple-developer-merchantid-domain-association.txt
Related reading
- Project structure in Commerce on Cloud Guide
- Get started with custom VCL snippets in Commerce on Cloud Guide
- Web property in Commerce on Cloud Guide