Enabling CF cache for static assets with AWS ALB sticky sessions and query string present under WP/APO

We have a WP install with APO enabled.

Our WP servers are behind an AWS Application Load Balancer with sticky sessions enabled (to preserve WP login sessions).

We have static asset URLs that look like this:

These assets are always served with cf-cache-status: BYPASS. (Our text/html documents are served HIT.)

I understand that there are at least two reasons why CF might not cache these assets:

  • The presence of the ?ver= parameter. I set a Page rule matching these static asset URLs with “Cache Level”: “Ignore Query String” and also “Cache Everything”.
  • The presence of a set-cookie header from AWS ALB (for stickiness). I tried to strip this header Via a “HTTP Response Header Modification” Transform Rule, I am stripping all set-cookie headers. (I am not seeing set-cookie in the browser, however I’m not sure whether this rule affects headers sent from the origin.)

No combination of these settings caused CF cache hits. Is there any way to accomplish what we want (other than using a cookieless domain)?

CF could really use a debugger for cache that explains cf-cache-status for a request.