add support for prefixing urls with domain

Nov 21, 2010 at 4:01 PM

One of the recommedations Google Page Speed and Yahoo YSlow suggest is serving your static files from a cookieless domain. Advantages are parallel loading of resources and less overhead because cookies are not send to this domain.

It would be cool if we could tell Combress to prefix the generated urls with a domain specified in the xml config file. So


would become

Dec 6, 2010 at 8:56 AM

I think you could just deploy Combres (and all the resources) to the server then it should just generate the expected URL.  So no need to be explicit about the server host.

Dec 7, 2010 at 3:02 PM

That is exactly how my setup is now. I'll try to explain how my app now works. My app listens to multiple host headers, say: and So my webstore can be reached at two URLS, but I configured the app that pages like product browsing and stuff only are available under

All my static content however (productimages, etc) are still available under All images I use on have absolute URLS: This wil speed the intial load time for the user:

Therefore it would be great to tell Combres to explicit prepend a domainname before the paths it generates.

Jan 25, 2011 at 4:20 AM

buunguyen, is there any plans to do this and allow domain/subdomain path in xml configuration file?

Jan 25, 2011 at 7:27 AM

I've added a ticket for it here: so that I can remember.

Mar 2, 2011 at 8:46 PM

Hi buunguyen,

Just looked at Combres and also find that I need to prefix the Url that accessed the site, also using multiple host headers AND multiple sub domin names,


In MVC, specifically the View/MasterView/ViewModel base classes I have "ApplicationRootUrl" property and prefix this to anything requiring a Url so all Urls look absolute when looking at the html source.

I am suggesting possibly adding a mode to the path called "absolute" that uses the absolute path, To get the ApplicationRootUrl I use the following code to get this:

public static string ApplicationRootUrl()
            string port = String.Empty;

            if (HttpContext.Current.Request.ServerVariables["SERVER_PORT"] != null && HttpContext.Current.Request.ServerVariables["SERVER_PORT"].ToString() != "80" && HttpContext.Current.Request.ServerVariables["SERVER_PORT"].ToString() != "443")
                port = String.Concat(":", HttpContext.Current.Request.ServerVariables["SERVER_PORT"].ToString());

            string protocol = "http://";

            if (HttpContext.Current.Request.ServerVariables["SERVER_PORT_SECURE"] != null && HttpContext.Current.Request.ServerVariables["SERVER_PORT_SECURE"] != "0")
                protocol = "https://";

            return String.Concat(protocol, String.Concat(HttpContext.Current.Request.Url.Host, port, HttpContext.Current.Request.ApplicationPath, '/').Replace(@"//", @"/").ToLower());

Hope this helps....


May 8, 2011 at 11:56 AM
Edited May 8, 2011 at 12:09 PM

This would also allow for much easier integration with a 'pull' type of cdn for delivering files managed by combres - definately has my vote!

I should also mention, you should support seperate http/https prefixes - as most setups use different subdomains for https

May 29, 2011 at 7:04 AM

I've introduced a <host> attribute to the root setting.  This will be used as the prefix to the domain.  The generated URLs for resource sets (and resources in no-pipe-line-debug mode) will used this as a prefix to form the absolute URL.  This change is both in the trunk and latest NuGet package (  If somebody could give it a try and let me know if this change helps with what you want to achieve or not, that would be great.

May 29, 2011 at 12:35 PM


This is awesome - and almost exactly what I needed. Literally the ONLY change I would make is to add an sslHost attribute as well. Combres would automatically determine which one to use based upon the Request.IsSecureConnection property - does that make sense?