StackPath EdgeRules allow you to customize the way StackPath responds to requests for websites. To make the setup process even easier, the most popular rules are included in single-click presets.
The StackPath preset EdgeRules take effect as soon as StackPath's servers receive the request and are compatible with both CDN and WAF integrations.
These rules will only work with domains that resolve to the StackPath Systems. When using a custom delivery domain, or full site integration, this will require making changes to your DNS records, you can read more here.
Force WWW Connections
The Force WWW Connections Rule redirects every request to a WWW subdomain. This works on all requests towards the StackPath Edge Address and any delivery domains that have been set up. Because of this, this rule is only recommended to redirect the apex domain to your WWW subdomain, assuming both already resolve to the CDN through DNS. It is recommended that this rule to only be used with a Full Site Integration.
This rule will affect the StackPath Edge Address and any subdomains you have set up as delivery domains. This will redirect any assets at h8j6g5r2.stackpathcdn.com to be at www.h8j6g5r2.stackpathcdn.com, when using the Edge Address For integration, preventing anything from loading. Similarly, if you have any custom subdomains in use as delivery domains, cdn.yourdomain.com, for example, will redirect to www.cdn.yourdomain.com and become unusable.
EdgeRules instantly become active as soon as they are enabled. This allows for instant testing and configuration adjustments. Testing in a browser is ideal because this will provide visual feedback to indicate the rules are redirecting properly. A complete integration will automatically cause the desired redirect to the appropriate protocol or subdomain.
The 301 Response Code indicates a permanent redirect, so based on the above example image, the initial request redirects to a secure domain (green lock) which then redirects to an unusable WWW subdomain.
Alternatively, using cURL commands on a Mac OS or Linux terminal will show the desired behavior as well. A cURL command with the -IL options will force the process to follow any 301 redirects and show the response headers through the entire process (as shown above with cURLs towards a Edge Address).
If you have any questions about EdgeRules, StackPath Support is available 24/7 via live chat or ticket.