AMP Cache Sandeep Davu
What is AMP?
= Accelerated Mobile Pages AMP is an open standard developed by Google to make the mobile web faster. 1 AMP HTML 2 AMP Viewer 3 AMP Cache HTML with some restrictions and AMP extensions Static layout Inline CSS No <script> tags Prefetch and Prerender AMP page in a customized iFrame. Fetch content in parallel. Only Cache and Serve AMP Content. Google and Cloudflare are the AMP Caches available for now. AMP Cache approach is a deviation from the traditional origin approach. The domain that servers the pages should have the amp page.
Cache AMP CACHE – URL FORMAT, VALIDATION, CACHE UPDATE Origin is not google. So validation is done to ensure that the document is indeed AMP compliant before serving and Caching.
Why AMP ? To give user a consistent Yahoo Experience even for third party content. To keep the user on the Yahoo Homepage
What More? We want to keep the content in-house How? Host our own AMP Cache Why? Own the metrics. Do custom optimizations. Drive publishers to come to Yahoo for AMP Cache support. AMP Ecosystem is very suggestive of hosting AMP Caches. There are certain guidelines that we have to comply to be a AMP Cache.
AMPCache Architecturewant to be?
AMP Cache Layer 1 ATS AMP requests are routed through AMP Cache. www-reuters-com.amp.yimg.com/c/s/www.reuters.com/sample.html www.yahoo.com/amphtml/sample.html ATS Remap lua plugin Computes query URL to pass to validator amp-validator.yahoo.com/?url=www.reuters.com/amphtml/sample.html Send the request through Caching Layer Layer 2 caching Layer Carp for sending to the right node. SWR for updating the Cache. Caches valid responses from AMP Validator.
AMP Validator Ensure cache only contains valid AMP pages Express Service that uses open source amp-validator NPM package. Sends the AMP request to the origin servers based on the query URL. Validates the response before sending it back to ATS Else transforms response to display errors
Future Plans AMP Cache Update API Publishers can perform CRUD operations on their cached resources in our AMP cache example-com.cdn.ampproject.com/update-cache/example.com/c/s/sample.html?amp_action=flush&_url_signature=<sig_val> Security - CSP Safeguard against XSS and data injection. Get Certified with Google CORS headers.