ColdBox 8.0.5: Routes return 404 without index.cfm, but work with index.cfm (CommandBox 6.3.2)

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=1 does not refresh the routes
  • Deleting the .server folder 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!

Hola @Eduardo_Augusto

I tested it and yes you are correct, the paths /rest/xxx are being blocked. I am guessing the CommandBox server protection profiles are kicking in. @bdw429s is there a way to bypass this?

This is not a ColdBox issue, fyi/

CommandBox doesn’t block /rest URLs. They should be rewritten as normal.

Start your server with the --console --trace flags. Once it’s up hit enter a few times in the console and then refresh the page a single time and paste the logs in here. They will tell us what’s happening.