Created
March 17, 2012 02:01
-
-
Save adbrowne/2054342 to your computer and use it in GitHub Desktop.
Configuring Cassette to work with a CDN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var staticDomain = ConfigurationManager.AppSettings["StaticDomain"]; | |
settings.UrlModifier = new StaticDomainUrlModifier(settings.UrlModifier, staticDomain); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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