From 5f6b57d80efe7fd59742005272df015cb842d399 Mon Sep 17 00:00:00 2001 From: Clement Boirie Date: Wed, 6 Apr 2022 12:34:22 +0200 Subject: [PATCH] Add ETag header to product feed response. --- src/Feed/Generator.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Feed/Generator.php b/src/Feed/Generator.php index 493e8e20..fac27ad7 100644 --- a/src/Feed/Generator.php +++ b/src/Feed/Generator.php @@ -246,9 +246,14 @@ public function render( $no_cache = false ) { } if ( is_file( $file_path ) ) { + $etag = sprintf( '"%s"', md5_file( $file_path ) ); + header( 'Content-Type: application/xml; charset=utf-8' ); header( 'Content-Length: ' . filesize( $file_path ) ); nocache_headers(); + header( 'ETag: ' . $etag ); + header( 'X-SFtag: ' . $etag ); + readfile( $file_path ); exit; }