WebP rewrite rule ignored after adding custom headers for images

#1
The usual rewrite rule that I stick inside the "/" static context works fine by itself:

RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]


But as soon as I add custom Cache-Control headers for images in another static rule (going by the guides), the webp rewrite rule no longer gets obeyed and I never again see a webp image get loaded. Here's what I have for the other context:

context exp:^.*(a?png|gif|jpe?g|svg|webp)$ {
location $DOC_ROOT/$0
allowBrowse 1
note Cache-Control for images. Store for 28 days before re-validating.
extraHeaders <<<END_extraHeaders
unset Last-Modified
unset Cache-control
set Cache-control max-age=2419200, must-revalidate
END_extraHeaders


Re-arranging the "Order" does nothing. Enabling "Inherit Rewrite Rules" does nothing. Do I need to write another rule in this more-specific context? Can a regex wizard help me figure out what that rule would be?
 
Top