Cassette and CDN
If you use cassette to bundle your CSS + JS you will notice it's cassette.axd path is always relative to your website. e.g /cassette.axd/script/6bc12af9524f7419f608f3d382a642a606007365/js"
You may however want cassette to output something like this:
http://media.my.cdn/cassette.axd/script/6bc12af9524f7419f608f3d382a642a606007365/js"
This is not straightforward but I've found a workaround as follows:
public class CustomCassetteServices
{
public void Configure(TinyIoCContainer container)
{
container.Register<IUrlGenerator>((TinyIoCContainer c, NamedParameterOverloads n) => new UrlGenerator(new EnsureAbsolutePathPrepender(), c.Resolve<CassetteSettings>().SourceDirectory, "http://media.my.cdn/cassette.axd/"));
}
}
public class EnsureAbsolutePathPrepender : IUrlModifier
{
public string Modify(string url)
{
return url.TrimStart(new char[]
{
'/'
});
}
} `