Trying to use AMP forms with action-xhr attributes and getting the Response must contain the AMP-Access-Control-Allow-Source-Origin header error? All you may need is to allow these in your .htaccess file.
2 answers
1
Fixing the header error using .htaccess
To allow these headers, you need to first open your .htaccess file located on your website’s server.
- Open your FTP client such as FileZilla and connect to your server;
- Locate your .htaccess file (normally found inside the public_html folder);
- Edit this file and add the code snippet below.
Header set Access-Control-Allow-Origin 'https://cdn.ampproject.org'
Header set AMP-Access-Control-Allow-Source-Origin 'https://your-domain.com'
— Support WizardAnswer 1
0
SSL certificates
Note that it may be that you need an SSL certificate for your website for this to work.
— Support WizardAnswer 2