Hello everyone,
I’m experiencing a strange routing issue in ColdBox and would appreciate some help from the community.
Environment
- ColdBox: 8.0.5
- CommandBox: 6.3.2
- Engine: Lucee (configured via
server.json) - URL rewrites enabled
The Issue
My routes only work when I include index.cfm in the URL.
This works:
Código
http://127.0.0.1:62971/index.cfm/rest/request
But this fails with a 404:
Código
http://127.0.0.1:62971/rest/request
The error is:
Código
404 – The event: rest.request is not a valid registered event
It looks like ColdBox is treating the URL as an MVC event instead of a routed endpoint, which suggests that URL rewriting is not being applied.
Strange Behavior Observed
- Old routes continue to work even after being removed from
Router.cfc - New routes do not work at all
- Restarting the server does not change anything
fwreinit=1does not refresh the routes- Deleting the
.serverfolder and restarting does not help - Rewrite is enabled in
server.json, but seems to be ignored
Current Router.cfc
cfml
component {
function configure(){
route( "/healthcheck", function( event, rc, prc ){
return "Ok!";
} );
get( "/api/echo", "Echo.index" );
// Route I'm trying to use
get( "/rest/request", "Echo.index" );
get( "/api/whoami", "Echo.whoami" );
route( ":handler/:action?" ).end();
}
}
server.json
json
{
"name":"My ColdBox App",
"app":{
"cfengine":"lucee"
},
"jvm":{
"heapSize":"512",
"javaVersion":"openjdk21_jre",
"args":"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8888"
},
"web":{
"rewrites":{
"enable":true
}
},
"scripts":{
"onServerInitialInstall":"install bx-compat-cfml,bx-esapi"
}
}
Has anyone experienced this before, or knows what might prevent CommandBox from applying rewrites correctly in this setup?
Thanks in advance for any help!