Skip to content

Verify domain with Apple Pay and Stripe using AWS Lightsail

0

Hello, I'm working on connecting Stripe and Apple Pay to my Lightsail instance. In order to validate the domain, Apple requires that we place a file in the .well-known folder. I placed the file and attempt to verify the domain but it does not work. I tried to access the file directly in the browser and it says permission denied. I tried changing the owner and group to bitnami and daemon but it still doesn't work. Any suggestions.

asked 3 years ago207 views

1 Answer
0

Greeting

Hi Incite Digital,

Thank you for reaching out! Connecting Stripe and Apple Pay to your Lightsail instance is a fantastic step toward enhancing your payment capabilities. I understand how frustrating it can be when domain verification doesn’t work as expected. Let’s tackle this issue together and get everything running smoothly. 😊


Clarifying the Issue

You’re working on connecting Stripe and Apple Pay, and to validate the domain, you’ve placed Apple’s verification file in the .well-known folder of your Lightsail instance. However, when you try to access the file in a browser, you receive a “permission denied” error. You’ve already tried adjusting the file’s owner and group but haven’t resolved the issue yet. No worries—we’ll explore the possible causes and get this sorted!


Why This Matters

Domain verification is essential for securely integrating Apple Pay with Stripe. It confirms your ownership of the domain and ensures that payment transactions are authorized and secure. Without completing this step, you can’t enable Apple Pay, potentially delaying a seamless payment experience for your users.


Key Terms

  • Apple Pay Domain Verification: A process Apple uses to confirm a domain is authorized for Apple Pay transactions.
  • .well-known Folder: A standardized directory for storing verification files and special configurations.
  • File Permissions: Settings that define which users or groups can read, write, or execute a file.
  • Web Server Configuration: Rules and settings that control how the server handles requests, such as access to specific folders.
  • SELinux: A Linux security module that enforces stricter access controls beyond basic permissions.
  • CDN: Content Delivery Network, such as Cloudflare, that may affect direct access to server files by caching or modifying requests.

The Solution (Our Recipe)

Steps at a Glance:

  1. Verify the location of the .well-known folder.
  2. Ensure the web server is configured to serve files from the .well-known folder.
  3. Check file permissions and ownership.
  4. Test the file’s accessibility in a browser.
  5. Address security module restrictions like SELinux.
  6. Verify CDN and reverse proxy configurations, if applicable.
  7. Examine server logs for further troubleshooting.

Step-by-Step Guide:

  1. Verify the location of the .well-known folder.
    Ensure that the .well-known folder is in your web server’s document root. For Bitnami instances, this is typically:
    /opt/bitnami/apache2/htdocs/.well-known

  1. Ensure the web server is configured to serve files from the .well-known folder.
    Update the Apache configuration to allow access to .well-known:

    <Directory "/opt/bitnami/apache2/htdocs/.well-known">
        Require all granted
    </Directory>

    Restart Apache to apply changes:

    sudo /opt/bitnami/ctlscript.sh restart apache
  2. Check file permissions and ownership.
    Set appropriate permissions and ownership to ensure the file is readable:

    sudo chmod 644 /opt/bitnami/apache2/htdocs/.well-known/apple-developer-merchantid-domain-association
    sudo chown bitnami:daemon /opt/bitnami/apache2/htdocs/.well-known/apple-developer-merchantid-domain-association

  1. Test the file’s accessibility in a browser.
    Navigate to:
    http://yourdomain.com/.well-known/apple-developer-merchantid-domain-association
    
    Confirm that the file contents are displayed.

  1. Address security module restrictions like SELinux.
    Temporarily disable SELinux to check if it’s causing the issue:
    sudo setenforce 0
    If this resolves the issue, use the following to adjust SELinux policies:
    sudo semanage fcontext -a -t httpd_sys_content_t "/opt/bitnami/apache2/htdocs/.well-known(/.*)?"  
    sudo restorecon -Rv /opt/bitnami/apache2/htdocs/.well-known

  1. Verify CDN and reverse proxy configurations, if applicable.
    If you’re using a CDN like Cloudflare or a reverse proxy, ensure that requests to .well-known are not cached or blocked. Temporarily bypass the CDN by accessing the server directly using its IP address or by disabling proxying for the domain.

  1. Examine server logs for further troubleshooting.
    Check your Apache error logs for additional clues:
    sudo tail -n 50 /opt/bitnami/apache2/logs/error_log
    Look for permission errors, missing files, or configuration issues.

Closing Thoughts

These steps should help you resolve the "permission denied" issue and complete the Apple Pay domain verification process. If you run into any additional challenges, let us know—this is an important step, and we’re here to help!

Here are some useful resources for further reading:


Farewell

Best of luck with your integration, Incite Digital! Let me know how it goes or if you need more assistance—happy to support your journey. 😊🚀


Cheers,

Aaron 😊

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.