The solution could be to use Expires for all assets, use mod_headers to remove headers from the non-cdn version, for example:
Rewriteengine on
RewriteRule ^ cdn / ([0-9a-z]) * / (. *) / $ 2 [L, E = cdn: 1]
ExpiresActive on
ExpiresDefault "access plus 1 year"
Header unset Expires env =! Cdn
Header unset Cache-Control env =! Cdn
This is a bit redundant for the root of the website, but if it applied only to assets, that would be a problem.
source share