Laravel Logs with simplest HTTP Basic Auth

There’s a cool visual log viewer for Laravel 4/5: rap2hpoutre/laravel-log-viewer. Installation is short and straight-forward but logs shouldn’t be accessible by anyone. That’s why I setup access password. The easier, the better so this time I just used HTTP Basic Auth but without database.

After the Log Viewer is installed I add a new routing:

Laravel comes up with auth.basic  filter but that’s not what I want since it needs an access to database containing ‘users’ table. Instead, I just change that default filter to a simple custom one in  app/filters.php :

My password hash (sha1) lies in .env.php  file.

In my case .htaccess  needed a modification, too. That’s what I got from Laravel’s Security:

Great! Now my logs are protected by password!

Resources