HttpsEnforcerMiddleware not redirecting to full path

The HttpsEnforcerMiddleware redirects http://localhost/dev/e4kids/coupons to https://localhost/coupons. I am using cakePHP 4.2.5
In Application.php I have -
->add(new HttpsEnforcerMiddleware([
‘redirect’=>true,
‘statusCode’=>302,
‘disableOnDebug’ => false,
]));