Hi Team,
We’re facing an issue where Eurasian Times articles are not opening in the Google News app.
Steps to reproduce:
A. Open the Google News mobile app.
B. Search for Eurasian Times.
C. Tap on any of the articles.
Example URL of an article as seen in the Google News app:
When accessed directly in a browser, this URL works correctly. However, when opened via the Google News app (with the AMP prefix https://www-eurasiantimes-com.cdn.ampproject.org/v/s/), the page loads as blank.
We also attempted to curl the above story URL. Please find the response attached.
-
This topic was modified 11 months by
NyttenET.
Hi,
The blank page in Google News is almost always caused by your AMP endpoints (amp-list / amp-access / consent APIs) failing when loaded from the Google AMP Cache domain.
Please try:
– Add proper CORS headers on those JSON endpoints:
– Access-Control-Allow-Origin: https://www-eurasiantimes-com.cdn.ampproject.org
– AMP-Access-Control-Allow-Source-Origin: https://www.eurasiantimes.com
– Access-Control-Expose-Headers: AMP-Access-Control-Allow-Source-Origin
Ensure they accept the __amp_source_origin query param.
Then re-test the cached URL with #development=1 to confirm no AMP errors.
Make sure you set correct AMP CORS headers on your API/consent endpoints, otherwise the body stays hidden in Google News.
Hi,
Regarding the CORS headers, we are using the AMP plugin. We have already reviewed the AMP plugin code, and the required headers are included by default.
Sample code from the plugin:
public static function send_cors_headers() {
$origin = null;
$source_origin = null;
if ( isset( $_SERVER['HTTP_ORIGIN'] ) ) {
$origin = wp_validate_redirect( wp_sanitize_redirect( esc_url_raw( wp_unslash( $_SERVER['HTTP_ORIGIN'] ) ) ) );
}
if ( isset( self::$purged_amp_query_vars['__amp_source_origin'] ) ) {
$source_origin = wp_validate_redirect( wp_sanitize_redirect( esc_url_raw( self::$purged_amp_query_vars['__amp_source_origin'] ) ) );
}
if ( ! $origin ) {
$origin = $source_origin;
}
if ( $origin ) {
self::send_header( 'Access-Control-Allow-Origin', $origin, [ 'replace' => false ] );
self::send_header( 'Access-Control-Allow-Credentials', 'true' );
self::send_header( 'Vary', 'Origin', [ 'replace' => false ] );
}
if ( $source_origin ) {
self::send_header( 'AMP-Access-Control-Allow-Source-Origin', $source_origin );
self::send_header( 'Access-Control-Expose-Headers', 'AMP-Access-Control-Allow-Source-Origin', [ 'replace' => false ] );
}
}
-
This reply was modified 11 months by
NyttenET.