Migrating Legacy Project from IIS

Hello, I’m in the process of migrating a project over from IIS to Commandbox to help aid in the company’s objective to finally get out of cowboy coding and implement version control. This project has hundreds of files and they’re all.htm with cfml tags all over them.

With IIS, I would just update the web.xml and add servlet mappings and then update uriworkerer properties file and IIS would pass that htm pages over to coldfusion and everything worked.

With Commandbox, I’ve been having a really hard time. Nothing I’ve done has gotten htm files to be sent to coldfusion for execution/serving. I’ve tried a custom webxml, tried setting the servlet mappings in the server.json file, and even tried adding the mapping directly to the web-inf web.xml but not luck. I’ve tried following all of chatgpt’s and Gemini’s suggestions. Chatgpt eventually gave up and said it isn’t possible. Gemini keeps me going in a loop.

Has anyone achieved this? Thanks

A.I. is dumb, lol. The same changes need to be made, but you’re just missing the CommandBox equiv to the uriworker.

You need to make the exact same web.xml changes, but don’t just change the file directly-- CommandBox manages your sever home, so any edits yo make to the web.xml will get blown away when you forget the server or update to a new version of CF. Instead, use our web.xml override feature

That page in the docs actually shows adding .html as an example.

Secondly, you need the requests to reach CF in the first place, and not be seen as static files. This is the equiv of your urlworker setting, and CommandBox calls it the servlet pass predicate. it decides what requests are passed to the servlet.

The default predicate is

regex( '^/(.+?\\.cf[cms])(/.*)?$' ) or regex( '^/(.+?\\.bx[sm]{0,1})(/.*)?$' )

You’ll just need to modify that to include your other extensions.

Keep mind when you put the regex in the server.json, you’ll have to escape al the \ chars for the JSON file.