The bellow Fastly recv ACL rule will allow to redirect the users to a custom maintenance page (even a CMS page if you like) for a specific domain.
It will still allow the /media
and static content (themes) files to be viewed - which allows to build custom maintenance
pages right in the admin area with CMS Pages.
Also, it's taking into account the list of IPs to whitelist from the redirect using the Fastly Edge ACL - in this example
the name is maint_allowlist
.
This comes in hand when you've got an Adobe Commerce/ Magento 2 instance powering multiple websites. That's because with the
built-in maintenance page (whic is enabled via CLI bin/magento maintenance:enable
) this will affect all websites, not only
the one you'd like.
if (
req.http.host ~ "your-domain\.com" &&
(
req.url !~ "^/maintenance-page-url" &&
req.url !~ "^/static" &&
req.url !~ "^/media"
) &&
!(client.ip ~ maint_allowlist) &&
!req.http.Fastly-FF
) {
set req.url = "/maintenance-page-url";
}
Adding the IPs to whitelist
Adding the recv ACL rule: