Some sites are defaulting to the webroot folder instead of their own

I’ve been running Lucee for a while with no issues. A Windows update crashed my system to the point I needed to reinstall the OS. After my system was back up again I started by setting up IIS, then I downloaded a new copy of Lucee (lucee-5.3.8.201-pl0-windows-installer.exe) and installed it. Side note, my web folder directory structure has webroot as the root folder, then each site has it’s own subfolder. I’ve been adding my websites to IIS and most work fine, but I have two sites that when I go to them in the web browser, it displays the correct URL, but the webpage is the one from the root folder. I’ve tried removing the site from IIS and adding it again, but that doesn’t help, even if I change the site name.

I’ve noticed that every time I go to one of my sites, after the page loads, the page name in the url ends in a ? like http://sitename.com/index.cfm? This happens for the sites that work and the ones that don’t work. I didn’t have that prior to the reinstall…and one one of the sites I’m having a problem with, if I leave the ? there, the index.cfm page is fine, but if I remove the ? it reverts to the root index.cfm.

I’ve verified in IIS that it has the correct path to the site folder; and I’ve tried putting the following at the top of both the application.cfm and index.cfm pages:
TEST

I did this to see if I could break the process prior to any CFM location tags redirecting me, But the page still loads the root index.cfm file.

Don’t forget to tell us about your stack!

OS: Windows 10 Pro
Java Version: none
Tomcat Version: 9
Lucee Version: 5.3.8.201

Are you using Boncode?

I didn’t install that separately, so unless it was part of the lucee installer, I don’t believe so. I don’t see it when I do a search of my drive.

I take that back…I do see it in c:\windows which was new since the install, so it might have been installed by the installer.

Currently I have 14 sites setup in IIS and only 2 of them aren’t working.

Hard to say since there are a lot of moving pieces at play. I would work on tracing the request through in the logs to confirm which IIS site is actually being hit. Also double check that

  • BonCode is installed for ALL sites
  • the BonCode handlers are setup at the server level and not overridden at any of the site levels
  • Enable the mod_cfml Tomcat valve logging to see what the contextID is of the incoming sites.

https://viviotech.github.io/mod_cfml/docs-valve.html

Could you check what redirect http status code you are getting in your browser? 302? 307?

Is it possible that that root webroot was the default webroot during installation, and then you changed/copied the other websites webroots into this very same folder? Where is/was that webroot located? In Tomcats webapp folder? Or just somewhere outside?

I suspect something is wrong with your tomcat and mod_cfml configuration. How do your config folder in path-to-lucee/tomcat/config/catalina/ looks like? Check all the root.xml files of the respective sites. Check if these are pointing correctly to their respective webroots.

I will look into that. AFAIK I didn’t use BonCode on my previous setup, and I now have 25 sites setup in IIS and still only 2 of them are having this issue, so I think something else might be going on.

First off, thank you for your reply, I appreciate the help.

I’m not sure what the difference is between root webroot and default webroot. My webroot is C:\inetpub\wwwroot every site has it’s own folder within that directory. FYI, my Lucee install is C:\Lucee and none of my web content is in there.

This is interesting, I’ve tried making a copy of the directory that is giving me issues, and renaming it to something else, then I’ve tried deleting the site in IIS, and recreating it with the new directory, but the IIS ID is still the same and the issue still persists. When I go to the Catalina directory I don’t see anything named “Config”, what I see is a bunch of folders named w3svcxx and I presume the xx is the ID from IIS. When I look at the xml file for the main site giving me issues, I see:

<?xml version='1.0' encoding='utf-8'?> WEB-INF/web.xml

The directory above is the original folder (not the renamed one), but it is the correct folder for this app.

Following up on Brads advice above, I tried to turn on logging…I restarted the Apache Tomcat service and the site started working. This is odd, because I have restarted my server in the process of trying to fix this, so I’m not sure why this worked, but at least for right now, it seems to be working. I’ll keep playing with it. @Brad_Wood and @andreas thanks for the advice, I really appreciate the help.

1 Like

The problem is, IIS doesn’t “talk” to Lucee unless you have some sort of proxy in place. If you just configure a basic reverse proxy, every IIS site will be hitting the default Lucee/Tomcat web root on the back end. The only way to have your IIS web root be passed back to Tomcat to use is via BonCode installed in IIS and the mod_cfml valve in Tomcat. If you were using multiple sites, there’s a 99% chance you were using Boncode or there’s basically no way it would have worked!

Right, I get it… only are having the issue, you can’t recall what yo installed, etc. I gave you troubleshooting steps in my previous message and instead of following them, you’re repeating yourself. Help me help you :slight_smile:

I am interested in learning more about the process, just to understand it better (even though it appears to be working now). If BonCode and mod_cfml are installed as part of the Lucee installer, then yes, I have them and they are installed. I’m not sure how to check for that, but I do host like 21 sites on this server and they all appear to be working as expected now. From what you said above, it sounds like I must have BonCode.

Just in case you missed it above, it was following your troubleshooting steps that the site started working, and again, I want to thank you for your assistance and guidance, it is very much appreciated.

I did miss it, sorry. I’m on conference WIFI today and your previous message wasn’t showing yet.

The way mod_cfml works is it caches the mapping of context IDs and the web root. I’m guessing the IIS site was created after the server was started and for some reason the restart perhaps didn’t work so it was still using the default web root.

It’s worth noting, there are two “default” sites or web roots at play here.

  • IIS has its own default site which is used if the incoming host/port bindings do not match any of the existing sites. The default site in IIS will have its own web root
  • Tomcat has its own default servlet context, which will have a doc root. In Lucee, it usually points to a folder with the little ‘welcome to Lucee’ index.cfm page which is under the Lucee war. This is the context Mod_cfml will use if the incoming request doesn’t have the correct headers.

If BonCode and mod_cfml are installed as part of the Lucee installer

Not quite. The mod_cfml Tomcat valve is installed by default by the Lucee Installer. I know if the installer can “find” Apache, it will install the mod_cfml module there. I’m not sure if the installer will try to put Boncode into IIS for you. I didn’t think so, but I also haven’t used the Lucee installer in quite a few years (in favor of CommandBox)

I’m not sure how to check for that

Looking for the handler mappings I mentioned above. Installing Boncode at a global level will

the more sites you add onto tomcat the longer time you need to generate the contexts.

My suggestion is play with your

timeBetweenContexts="2000"

Lower the value to a fraction of this, ie if you have SSD and running 16GB of memory or more for your server, then this value should be 500 or less.

I have the same problem, some sites fall into a default site.
But, I have a different environment : Linux-Apache-Tomcat-Lucee
Then, I would like to know where is that variable : timeBetweenContexts
In where/what file ?
Many thanks,
Pierre.

It’s in the /opt/lucee/tomcat/conf/server.xml within the mod_cfml valve setting:

This snippet was taken from https://viviotech.github.io/mod_cfml/install-valve-win.html:

<Valve
className="mod_cfml.core"
loggingEnabled="false"
maxContexts="100"
timeBetweenContexts="0"
scanClassPaths="false"
sharedKey="secret key also set in the Apache/IIS config" />
1 Like

OK, good, I have for the moment :
<Valve className=“mod_cfml.core”
loggingEnabled=“false”
maxContexts=“200”
timeBetweenContexts=“2000”
scanClassPaths=“false”
sharedKey="

Then I will change 2000 to 500
and see.

Thanks you.

2 Likes