Primetime Ad Insertion provides rule-based URL rewriting to optimize client protocols and CDN delivery. For instance, rules can be created to force Primetime Ad Insertion to fetch resources from the CDN only under the HTTP protocol, even if the protocol to Primetime Ad Insertion is under HTTPS. Additional rules can be created that map video ad fragment URLs to the content CDN, ensuring single CDN delivery.