mwrock / RequestReduce

Instantly makes your .net website faster by reducing the number and size of requests with almost no effort.
www.requestreduce.org
Apache License 2.0
228 stars 48 forks source link

Registry.UrlTransformer #160

Closed STRUDSO closed 12 years ago

STRUDSO commented 12 years ago

Context seems to be null always, and HttpContext.Current is null aswell.

I have a mixed ssl none ssl site and wanted to change "urls" from http to https. Also i'm using the contenthost to load content from cdn.

And my ssl is terminated in loadbalancer so i have a hostheader with a "flag" whether we are secure or not.

Any ideas on howto solve this?

mwrock commented 12 years ago

The context will sometimes be null for instance when it is generating sprites or transforming image URLs in the css to use the contentHost because this is done on a background thread without access to the HttpContext. I know the issue of mixed http/https and using UrlTransformer has come up before either under a different issue or maybe in an email exchange. I'll look it up and get back to you soon.

mwrock commented 12 years ago

Sorry for the delayed response. I found the email exchange I was refering to but that won't really work for you. It does seem important that RR come up with a good way to address this scenario since I would think it is fairly common. The best way I could think of to deal with this for now is to always use a https url if the context is null. This should only include references to resources inside of your CSS (mainly background images).

However, if your CDN charges extra for SSL content, I could see this as being a bad solution.

Let me know your thoughts on this.

mwrock commented 12 years ago

closing this out for now. Let me know if you want to proceed further.