CodeIgniter 4 CLI Server Infinite Loading When Navigating Between Pages [closed]

I’m facing an issue with my CodeIgniter 4 project when running the server using the built-in CLI (php spark serve). The application initially loads fine, but when I try to navigate from one page to another (using internal links or redirects), the browser enters an infinite loading state. It just keeps loading and nothing appears.

Here’s I’ve observed:

If I cancel the loading manually and then reload the page, it works fine.

If I stop the server and then start it again using php spark serve, it also works as expected temporarily.