@BM Thanks for asking question! If you want to configure static web app behind Azure Application Gateway, then to restrict traffic to a specific CDN, configure your CDN to add a header containing a predefined, secret value to every request, and configure Static Web Apps to require the header.
To restrict traffic to an Azure Application Gateway, configure your app to only allow traffic from your Application Gateway's IP.
Also, configure your app to allow forwarding of your CDN or Application Gateway's hostnames.
Also could you confirm if you have configured the custom domain for your Static Web App, correctly by referring to official doc: Set up a custom domain with Azure DNS in Azure Static Web Apps
See video link here might be helpful. Let us know.