我正在开发一个新的 Laravel 4 项目,我想通过 SSL 协议(protocol)保护身份验证路由,老实说,我搜索了 2 天但没有成功,我不知道该怎么做。
这是我的 routes.php 文件:
Route::group(array('before' => 'guest'), function(){
/*==========================
| csrf PROTECTION
*///========================
Route::group(array('before' => 'csrf'), function(){
/*==========================
| Post Sign-in
*///========================
Route::post('/account/sign-in', array(
'as' => 'account-sign-in-post',
'uses' => 'AccountController@postSignIn'
));
});
/*==========================
| Get Sign-in
*///========================
Route::get('/account/sign-in', array(
'as' => 'account-sign-in',
'uses' => 'AccountController@getSignIn'
));
});
我想知道是否可以使用 wamp,或者只能使用真实的主机服务器来完成,我们将不胜感激,抱歉我的英语不好。
最佳答案
您可以强制路由使用 https 提供服务。例如:
Route::get('account/sign-in', array('https', function()
{
return 'Must be over HTTPS';
}));
关于ssl - 用户 Laravel 4 的安全身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23855863/