Dev environment not recognized in IpRestrictMiddleware.php

I installed mautic in Ubuntu with nginx.
I significantly adapted the nginx configuration of proffalken.
I cloned the github repository and executed composer install
The integration with a database using the web installer works fine.
I got the success page.

I want to switch to the development mode before I integrate a mail server.
I added a file .env.local in the mautic root folder with

APP_ENV=dev
APP_DEBUG=1

However, this apparently brakes the application.
After that, the page /installer responded:
You are not allowed to access this file.

My work around was to replace in app/middlewares/Dev/IpRestrictMiddleware.php:

if (in_array($request->getClientIp(), $this->allowedIps) || false !== getenv('DDEV_TLD') )`

with

if (in_array($request->getClientIp(), $this->allowedIps) || false !== getenv('DDEV_TLD') || $_SERVER['APP_ENV'] === 'dev')

But, there might be something else that would fix this problem
in a better way. Any help would be appreciated.