Join 3,520 readers in helping fund MetaFilter (Hide)


How do I properly separate two ColdFusion apps on IIS by subdomain?
October 31, 2008 6:03 AM   Subscribe

Two ColdFusion applications on separate subdomains in IIS are getting confused with eachother. How do I properly separate them? Note: My experience with ColdFusion starts with Metafilter and ends with my recent editing of jrun-web.xml.

We recently installed an additional ColdFusion application on an IIS server. There was already an existing CF app installed, so we created a new website entry in IIS and are separating them by subdomain, by giving them different Host Header entries in IIS, i.e.:

www.domain.com -> Existing (old) app
newproduct.domain.com -> Newly-installed app

Something, however, is causing them to run over eachother. Here's the basic scenario:

1. Load www.domain.com, the old app shows up.
2. Load newproduct.domain.com, the new app shows up.
3. Try to load the old app again, www.domain.com, but the new one shows up instead.
4. After a few minutes, you can start over with step 1 and get the old app back.

This is not a browser issue, since right after Step 2 I can hop over to a completely different network and browser, and Step 3 still occurs.

Both apps use "index.cfm" as their default page. I have lots of different applications separated on this IIS server by subdomain and this has never happened before, but they're plain PHP/HTML. I feel like this is a ColdFusion issue, but I don't know how to diagnose it beyond that.

Any tips are appreciated!
posted by odinsdream to Computers & Internet (11 answers total)
 
I haven't touched any ColdFusion, and I am not sure what version of IIS you're using (IIS 7 is sort of a new ball game), but the magic words you're looking for are "Application Pool." I'd give you a 65% probability that this is the answer.
posted by adipocere at 6:48 AM on October 31, 2008


I doubt this has anything to do with IIS application pooling, since that doesn't affect CF applications.

You haven't specified what version of CF you're using, but in CF 6 and higher, there's an option in the CF Administrator to cache web server paths. This was enabled by default in CF 6, but usually isn't enabled on later versions. This causes the CF server to only store file names, and not paths, so if you have two directories with index.cfm, requests for the second would go ahead and use the compiled version of the first.
posted by me & my monkey at 6:57 AM on October 31, 2008


I thought practically anything IIS ran as an application used an app pool (or the default app pool). Like I said, I know nothing about ColdFusion, sadly.
posted by adipocere at 7:15 AM on October 31, 2008


Is it possible this is a cookie issue? I haven't used CF since v8, but I recall it relies heavily on cookies to maintain session state. Are you sure none of the cookies are domain cookies (domain.com rather than www.domain.com/newproduct.domain.com)? A quick check of your browser cookies should reveal this.

I thought practically anything IIS ran as an application used an app pool (or the default app pool).

You're confusing IIS and .NET.
posted by mkultra at 7:31 AM on October 31, 2008


Be sure you have a separate application.cfm file in the root of each site, with a cfapplication tag in each one that specifies a unique application name.
posted by nonliteral at 7:45 AM on October 31, 2008


This CF documentation mentions a Web Server Configuration Tool. I don't have this file on my server, but it sounds like this does some of the setup that may be the key.

The CF virtual directories only exist under the "Default Web Site" entry in IIS, not under either the old or new app web sites. From the documentation hints, apparently each app should have their own CF virtual directories, which the WSCT can help set up.
posted by odinsdream at 7:56 AM on October 31, 2008


nonliteral:

Both apps have application.cfm files. The old one has a CFAPPLICATION tag, but the new one does not.

The new one just has:
<cfinclude template="global.cfm">

And global.cfm does not have a CFAPPLICATION tag either, just some entries defining DSNs, webroots, and directories, all of which are correct.

Should I add a CFAPPLICATION tag to the new app, making it different than the old app?
posted by odinsdream at 8:00 AM on October 31, 2008


I thought practically anything IIS ran as an application used an app pool (or the default app pool).

The CF ISAPI filter/extension does, but the CF service proper does not - it runs as a separate process.

This CF documentation mentions a Web Server Configuration Tool. I don't have this file on my server, but it sounds like this does some of the setup that may be the key.

It almost certainly is on your server, even if there's no icon for it in your Start menu. You can invoke it by running c:\coldfusion8\runtime\bin\wsconfig.exe on a default CF 8 Windows install. But I don't think that's going to help you; all it does is configure IIS to talk to CF. It has nothing to do with application isolation, unless you're running multiple instances of CF to isolate those applications (you're almost certainly not doing that).

Did you look for the "cache web server paths" option I mentioned earlier? That is by far the most common cause for this problem. On CF 8, it's available in the CF Administrator under "Server Settings" ... "Caching".

Should I add a CFAPPLICATION tag to the new app, making it different than the old app?

Yes, that's generally a good idea, but probably won't solve this specific problem.

Contact me via memail if you want me to help directly, I guess.
posted by me & my monkey at 8:10 AM on October 31, 2008


Should I add a CFAPPLICATION tag to the new app, making it different than the old app?

Yes, that's generally a good idea, but probably won't solve this specific problem.


Actually, it might. CFAPPLICATION's main purpose is to define application scope, and how app/session variables are stored. And it's where you configure cookies to be cross-subdomain, as I noted above.
posted by mkultra at 8:19 AM on October 31, 2008


Did you look for the "cache web server paths" option I mentioned earlier? That is by far the most common cause for this problem. On CF 8, it's available in the CF Administrator under "Server Settings" ... "Caching".

Hey that was it!

I also added the CFAPPLICATION tag to the new app's global.cfm, but I'm pretty sure the caching setting is what actually fixed the issue.

Thanks everyone!
posted by odinsdream at 8:30 AM on October 31, 2008


CFAPPLICATION's main purpose is to define application scope, and how app/session variables are stored. And it's where you configure cookies to be cross-subdomain, as I noted above.

That's why I said "probably."

That said, there are a few reasons why this is unlikely to be the cause. First, if the application directories are parallel rather than nested within each other, as they would be in a proper configuration, the directory without the CFAPPLICATION tag in its Application.cfm won't have session variables at all, nor will it have an application scope at all. Second, unless the program logic within the pages in both directories is identical, running one wouldn't give you the other page even if these scopes overlapped.
posted by me & my monkey at 8:42 AM on October 31, 2008


« Older I need practical advice on swi...   |  I have the option of moving to... Newer »
This thread is closed to new comments.