Caching fonts (CORS)


#1

I have worked out that when hosting a font that we need to create a CORS response first.

Currently I have set that up as a header within the content section - and that works fine (in that I can access the font file from a URL that I know is routing via Fastly)

However, these fonts always have a x-cache: miss

accept-ranges: bytes accept-ranges: bytes accept-ranges: bytes access-control-allow-origin: * age: 0 age: 0 cache-control: max-age=600,stale-while-revalidate=10800 content-length: 77160 date: Wed, 12 Dec 2018 00:49:40 GMT last-modified: Wed, 12 Dec 2018 00:37:50 GMT server: Apache/2.4 set-cookie: X-Mapping-oagconom=CD7E80CD8471269DEBD8BD67E0A38BF0; path=/ status: 200 strict-transport-security: max-age=900 via: 1.1 varnish x-cache: MISS x-cache-hits: 0 x-served-by: cache-lhr6350-LHR x-timer: S1544575780.141105,VS0,VE278

Is it possible to cache a file that has a CORS request preceding the actual request? If so, how.

(The file request is routing via Fastly, just it is not caching)

Thanks! Alex


#2

Thanks to Fastly support for helping me here.

Turns out my load balancers add Set-Cookie to the response - and this was stopping Fastly from caching correctly. Have removed that header (from within Fastly) and now all caches as it should