It is strange that ignoring small details will fail the configuration. My environment file had url as localhost:4200. I updated it to http://localhost:4200 and it worked.
localhost:4200
http://localhost:4200