0

In a amp-list element, when I use a json file to load data, for exemple:

src="amp-listing.json", it works fine.

But when I use a json generate from a php script, for exemple: src="amp-listing.php", I have the error:

Uncaught (in promise) Error: failed fetching JSON data: HTTP error 406​​​

at ya (index.js:59)
at yb.g.createError (log.js:344)
at xhr-utils.js:384
at new Promise (<anonymous>)
at qg (xhr-utils.js:378)
at xhr-impl.js:184

I found that the problem is that AMP adds to the json request, the parameter __amp_source_origin=https%3A%2F%2Fwww.yourdomain.com

And the Apache mod_security module doesn't like %2F giving the error:

Not Acceptable! An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.

If I try __amp_source_origin=https://www.yourdomain.com it works properly! But of course, AMP encodes special characters.

Do you have any idea how to fix it?

Thanks!

Pau

  • I'm not familiar with the 406 error code, but this might help: https://stackoverflow.com/questions/14251851/what-is-406-not-acceptable-response-in-http – aynber Jun 23 '21 at 17:24

1 Answers1

0

The solution is to add a rule to mod_security in order to accept the %2F characters in the request URL.