cassette
cassette copied to clipboard
Issue with CDN url and images in stylesheet
Hi,
I am using a CDN, and uses a custom url modifier like this:
public class CassetteSettingsBundler : IConfiguration<Cassette.TinyIoC.TinyIoCContainer>
{
public void Configure(TinyIoCContainer configurable)
{
configurable.Register<IUrlModifier>(new MyModifier());
}
}
public class MyModifier: IUrlModifier
{
public string Modify(string url)
{
return /test/test2 + url;
}
}
It works fine for CSS og JS, but for images which are in the stylesheets, it gives me a 404.
If I remove my url modifier, the url in the stylesheet looks like this: http://mysite.com/cassette.axd/file/images/www/layout/boxes/BoxContentTop-xxxx.png and it works.
When I add the url modifier, the url looks like this: http://mysite.com/test/test2/cassette.axd/file/images/www/layout/boxes/BoxContentTop-xxxx.png
The weird thing is that the file is found, otherwise it would be included in the stylesheet as the normal url (without the axd). If I try to access it as http://mysite.com/cassette.axd/file/images/www/layout/boxes/BoxContentTop-xxxx.png, without the url modifier, it works. It seems like the images can't be served through the modified url.
Am I doing this wrong, or is there perhaps a bug in the url modifier?
I'm experiencing the same issue. It's breaking references to our images and font files referenced in the CSS. I've even tried overwriting the URL to remove the cassette.axd and other portions added to the path, but the URL still ends up incorrect. I did find that adding the full URL, including HTTP, would cause the modifier to ignore it, but that's not a very practical solution since it require updating the stylesheet to test locally and remotely. @Phatzor did you have any luck with a solution?
I think it might also be related to #378.
@nsbingham Sorry no solution yet.
This is really a major blocker for me to be able to adopt CDN... Could not think of any way around it currently. As this is a long-standing issue, can I expect a fix for this anytime?