I have been using the auth.basic middleware for certain cronjobs. It worked completely fine until recently. Suddenly the prompt to login does not show anymore and it immidiately sends me to the normal login page. I did not make any changes to the routes, the controller in the route or the htaccess file.
In my htaccess file there is still this line:
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
I defined the route as follows:
Route::group(['middleware' => ['auth.basic','role:admin']], function() {
Route::get('/backup', 'ScriptController@cronjobs');
});
Does anybody know why the login prompt does not show anymore? I tried it on multiple devices on my server, as well as on my localhost. It does not seem to show up anymore.
Thank you!
So I found out what the problem was. Inside the controller someone added these lines:
public function __construct()
{
$this->middleware('auth');
$this->middleware('role:admin');
}
I am guessing this overwrote the auth.basic middleware. Now it's working as expected again!
Thanks anyways.