Expand my Community achievements bar.

SOLVED

How to skip Fastly CDN layer in aem cloud

Avatar

Level 9

We are planning to set up Akamai as the CDN to replace the default Fastly configuration and have added the following headers accordingly.

 

<LocationMatch "^/.*\.html$">
Header set Surrogate-Control "max-age=0, no-store, no-cache"
</LocationMatch>

 

But it is still caching the content in fastly and I can see "x-cache" header is set. Also I noted that "Surrogate-Control" header is not present. Is it omitted by Fastly ? Am I doing correct config? Please let us know if you have replaced fastly with any other cdn.

 

Mario248_0-1727091948078.png

 

1 Accepted Solution

Avatar

Correct answer by
Level 8

Hi @Mario248,

I can also confirm this, as we have the same setup with Akamai. I suggest setting the following options to prevent caching by Fastly:

Header set Surrogate-Control "private, max-age=0, stale-if-error=0, stale-while-revalidate=0"

In the responses, you should see always a MISS for x-cache, as this header is set by Fastly and not Dispatcher. Also, you won't see the Surrogate-Control header passed down.

 

Hope this helps,

Daniel

View solution in original post

4 Replies

Avatar

Community Advisor

x-cache MISS suggests that request was not cached at the CDN level. So, although the header is present your response was not served from CDN cache. If you are looking to completely bypass Fastly CDN, I don't think it will be possible since it is part of AEMaaCS architecture itself.
Hope this helps

Avatar

Level 9

x-cache value is "MISS" which means it is bypassed fastly layer. Is this header nothing to do with dispatcher cache ? Is my understanding correct ? Is this mentioned anywhere in aem doc?

 

 

Avatar

Community Advisor

Yes, as far as my understanding goes, this header is specific to Fastly CDN cache only and is not directly related to dispatcher cache. 
https://www.fastly.com/documentation/reference/http/http-headers/X-Cache/ 

Avatar

Correct answer by
Level 8

Hi @Mario248,

I can also confirm this, as we have the same setup with Akamai. I suggest setting the following options to prevent caching by Fastly:

Header set Surrogate-Control "private, max-age=0, stale-if-error=0, stale-while-revalidate=0"

In the responses, you should see always a MISS for x-cache, as this header is set by Fastly and not Dispatcher. Also, you won't see the Surrogate-Control header passed down.

 

Hope this helps,

Daniel