Search code examples
amp-html

Form submission failed:: Response must contain the AMP-Access-Control-Allow-Source-Origin header​


I'd like to use amp-form for a form submission. Sending text/data to database within same domain.

Upon a simple form submission I get this uncaught error: Form submission failed:: Response must contain the AMP-Access-Control-Allow-Source-Origin header​​​.

I've Googled and most answers have pointed me to set header within .htaccess document like so:

Header set Access-Control-Allow-Origin "*"

I'm continuing to search for an answer.


Solution

  • For security reasons, AMP requires certain headers to be present in cross-origin HTTP responses, including AMP-Access-Control-Allow-Source-Origin.

    See the CORS Requests in AMP documentation for the complete list.