Skip to content

Instantly share code, notes, and snippets.

@adbrowne
Created March 17, 2012 02:01
Show Gist options
  • Save adbrowne/2054342 to your computer and use it in GitHub Desktop.
Save adbrowne/2054342 to your computer and use it in GitHub Desktop.
Configuring Cassette to work with a CDN
var staticDomain = ConfigurationManager.AppSettings["StaticDomain"];
settings.UrlModifier = new StaticDomainUrlModifier(settings.UrlModifier, staticDomain);
public class StaticDomainUrlModifier : IUrlModifier
{
private readonly IUrlModifier baseModifier;
private readonly string staticDomain;
public StaticDomainUrlModifier(IUrlModifier baseModifier, string staticDomain)
{
this.baseModifier = baseModifier;
this.staticDomain = staticDomain;
}
/// <summary>
/// Prepends the static domain to the beginning of the server relative URL path.
/// </summary>
public string Modify(string url)
{
return staticDomain + baseModifier.Modify(url);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment