> The most interesting part of what you’re saying is that ColdBox handles URLs without a filename, which as we’ve both said, aren’t handed off the CF at all. How does ColdBox get to do anything at all in that case?
ColdBox handles all requests because they all have index.cfm in them. The rewrite rules enforce this. Even if the end user’s browser doesn’t show the index.cfm, the rewrite rule puts it there before it reaches CF. The only other way of doing this is to use a 404 handler that’s a cfm file. It works, but it’s janky IMO
> about ‘rewrites’, do you mean Apache or other web server rewrite rules?
Yes.
> Is that how ColdBox gets its hands on directory-only requests?
Yes. And to be clear, ColdBox has no idea it’s even happening. The URLs are modified on the fly in the web server before they ever hit CF.
> I was wondering if there was a CommandBox option or strategy that could accomplish the same thing.
CommandBox supports rewrites just like IIS or Apache and has since version 1. See the links I pasted in my last E-mail which detail them. There is a default set of rewrites that does the simple addition of index.cfm to your URLs, or you can create your own custom rewrites to do whatever you want.
> Just so I know, can a web server rewrite rule handle providing a default file when the requested directory doesn’t exist?
Yes. That’s what this whole conversation is about.
> I’m investigating if I can handle this case without a wbe server other than a CommandBox Lucee instance.
CommandBox supports all the same rewrites that IIS, Nginx, or Apache supports. Don’t worry about that. In fact, the second link I gave you is a blog post showing how to convert IIS rewrite rules to CommandBox! Apache is even easier, CommandBox can literally just read your .htaccess file as it’s written.
Thanks!
~Brad
ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com