Block request on Fastly CDN | Community
Skip to main content
bhavigoyal
Level 4
July 12, 2024
Solved

Block request on Fastly CDN

  • July 12, 2024
  • 3 replies
  • 1885 views

Is there any configuration on Fastly CDN to block the request on Fastly itself from hitting my AEM publisher or dispatcher?? It is to do with AEM Sites not with Commerce....

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by PGURUKRISHNA

Hi @bhavigoyal 

Yes, it is possible to set traffic filter rules, including rate limits, in AEM as a Cloud OOTB Fastly CDN. Some of the advanced WAF-based rules require an additional WAF or advanced security license, but the basic filter rules can be used OOTB.

You can create VCL snippets for the recv subroutine with the following VCL code:

if (req.url.path !~ "/media_[0-9a-f]{40,}[/a-zA-Z0-9_-]*\.[0-9a-z]+$"
&& req.url.ext !~ "(?i)^(gif|png|jpe?g|webp)$"
&& req.url.ext != "json"
&& req.url.path != "/.auth") {
// strip query string from request url
set req.url = req.url.path;
}

 

if (req.url.path !~ "/media_[0-9a-f]{40,}[/a-zA-Z0-9_-]*\.[0-9a-z]+$"
&& req.url.ext !~ "(?i)^(gif|png|jpe?g|webp)$"
&& req.url.ext != "json"
&& req.url.path != "/.auth") {
// strip query string from request url
set req.url = req.url.path;
}

set bereq.http.X-BYO-CDN-Type = "fastly";
set bereq.http.X-Push-Invalidation = "enabled";

 

This code enables the push invalidation including long cache TTLs.

You can also create a deliver snippet with the following VCL code:

unset resp.http.Age;

if (req.url.path !~ "\.plain\.html$") {
unset resp.http.X-Robots-Tag;
}

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/edge-delivery/launch/byo-cdn-fastly-setup

3 replies

arunpatidar
Community Advisor
Community Advisor
July 12, 2024
bhavigoyal
Level 4
July 18, 2024

Its helpful...

Community Advisor
July 12, 2024

Yes, it is possible to set the traffic filter rules, including rate limits, in AEM as a Cloud OOTB Fastly CDN. Some of the advanced WAF-based rules require an additional WAF or advanced security license, but the basic filter rules can be used OOTB. Please refer to the URLs below for more details.

Traffic Filter Rules including WAF Rules | Adobe Experience Manager

A Deep Dive into CDN Capabilities Within AEM as a Cloud | by Albin Issac | Tech Learnings | May, 2024 | Medium

Regards

Albin

https://myprofile.albinsblog.com

PGURUKRISHNA
PGURUKRISHNAAccepted solution
Level 4
July 15, 2024

Hi @bhavigoyal 

Yes, it is possible to set traffic filter rules, including rate limits, in AEM as a Cloud OOTB Fastly CDN. Some of the advanced WAF-based rules require an additional WAF or advanced security license, but the basic filter rules can be used OOTB.

You can create VCL snippets for the recv subroutine with the following VCL code:

if (req.url.path !~ "/media_[0-9a-f]{40,}[/a-zA-Z0-9_-]*\.[0-9a-z]+$"
&& req.url.ext !~ "(?i)^(gif|png|jpe?g|webp)$"
&& req.url.ext != "json"
&& req.url.path != "/.auth") {
// strip query string from request url
set req.url = req.url.path;
}

 

if (req.url.path !~ "/media_[0-9a-f]{40,}[/a-zA-Z0-9_-]*\.[0-9a-z]+$"
&& req.url.ext !~ "(?i)^(gif|png|jpe?g|webp)$"
&& req.url.ext != "json"
&& req.url.path != "/.auth") {
// strip query string from request url
set req.url = req.url.path;
}

set bereq.http.X-BYO-CDN-Type = "fastly";
set bereq.http.X-Push-Invalidation = "enabled";

 

This code enables the push invalidation including long cache TTLs.

You can also create a deliver snippet with the following VCL code:

unset resp.http.Age;

if (req.url.path !~ "\.plain\.html$") {
unset resp.http.X-Robots-Tag;
}

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/edge-delivery/launch/byo-cdn-fastly-setup

bhavigoyal
Level 4
July 18, 2024

Thanks. Its Helpful....