Invalid public key due to ingestion error: Invalid Content

Viewed 518

I'm tryining to invalidate some AMP pages. I read the documentation and some GitHub issues and the more I know the less I understand. ;)

I guess my public key was never crawled.

Via https://developers.google.com/amp/cache/update-cache#update-rsa-keys

If you want to update your RSA key, you can access the RSA key through the AMP Cache link and Google may crawl your new RSA key within several hours. Here is the AMP Cache link:

https://example-com.< cache.updateCacheApiDomainSuffix >/r/s/example.com/.well-known/amphtml/apikey.pub

So according to this my URL is: https://www-bronchicum-de.cdn.ampproject.org/r/s/www.bronchicum.de/.well-known/amphtml/apikey.pub The key is located at: https://www.bronchicum.de/.well-known/amphtml/apikey.pub (served publicly via plain/text)

Unfortunately I only get:

  1. That’s an error.

The requested URL /r/s/www.bronchicum.de/.well-known/amphtml/apikey.pub was not found on this server. That’s all we know.

When I'm trying to invalidate the cache (using digitalbrands/amp-cache) or a self written bash script, I get the following:

  1. That’s an error.

Your client does not have permission to get URL /update-cache/c/s/www.bronchicum.de/amp?amp_action=flush&amp_ts=1572261663&amp_url_signature=BxYM4-ky5wEVmeixpTqMZec3aDhUxcbkT32-kSXufPeO1fGFJ_p7I-xiPKih0oF5AOJy3XnLIvXy_btLXblOALb82BKvHj4UWtiWmtSgV3n-vH5_TVlrDU88UAa_EEZ4sDODwt2Auo1gREd4tZ_BDdXSbDBU5muCbld8KGiSO7mbQ62wWjWhZeXyo6AXqg7AmgCp5wdlwT1f00miYvALUB0gk7f9uDjTsEGIpEvGEwWQE0MllSiYXZ0XnwW2oGaJh8e3ofx0vx72omy9g5i6szgEgT_QR8hEPV_FTXN6V9n0E9A3drAOdyXGVKmFQHLP-knAI-sqfcrRMH2pNc856A from this server. (Client IP address: x.x.x.x)

Invalid public key due to ingestion error: Invalid Content That’s all we know.

Soooo... something wrong with my public key?

openssl dgst -sha256 -signature signature.bin -verify pulic-key.pem url.txt

Says "Verified OK". Can anyone please help me? :)

1 Answers

Just make sure that your response for /.well-known/amphtml/apikey.pub has Context-Type header with value text/plain.

For example, if you have an apache httpd server, then add the following lines in the .htaccess file.

<FilesMatch "apikey.pub">
ForceType text/plain
</FilesMatch>

After this, try submitting update cache and it should say 'OK'.

Related