Laravel中的随机内部服务器错误500

时间:2015-10-11 16:26:14

标签: php laravel laravel-4 internal-server-error

我的Laravel 4网站一直都很好用。我对控制器,迁移和视图进行了一些更改,并将这些文件与vendor文件夹一起上传。一切都很好,但当多个用户同时访问时,网站开始抛出内部服务器错误500.

我没有做任何重大改变,但我不知道为什么会发生这种变化。该网站运行正常,只有当流量增加时才会抛出此错误。

Http错误:

  

由于可能的配置错误,请求超出了10个内部重定向的限制。

Filter.php

<?php


/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/

Route::filter('auth', function()
{
    //if (Auth::guest()) return Redirect::guest('login');

    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::json(false, 401);
        } else {
            return Redirect::guest('login');
        }
    }

});


Route::filter('auth.basic', function()
{
    return Auth::basic();
});

/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
*/

Route::filter('guest', function()
{
    if (Auth::check()) return Redirect::to('/');
});

/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/

Route::filter('csrf', function()
{
    if (Session::token() != Input::get('_token'))
    {
        throw new Illuminate\Session\TokenMismatchException;
    }
});

Route::filter('confirm', function(){



    if (is_null(Auth::user()->is_find_match) &&  is_null(Auth::user()->is_match_maker))  {
        return Redirect::to('confirm');
    }
    if (is_null(Auth::user()->email)) {
        return Redirect::to('confirm');
    }
    if (is_null(Auth::user()->dob) || Auth::user()->dob == '0000-00-00 00:00:00') {
        return Redirect::to('confirm');
    }
    if (is_null(Auth::user()->religion_id)) {
        return Redirect::to('confirm');
    }
    if (is_null(Auth::user()->caste_id)) {
        return Redirect::to('confirm');
    }



});

/* URLs using confirm filter */


Route::when('matches', 'auth|confirm');
Route::when('matches/*', 'auth|confirm');
Route::when('profile', 'auth|confirm');
Route::when('friendsmatches', 'auth|confirm');
Route::when('friendsmatches/*', 'auth|confirm');
Route::when('newconnections', 'auth|confirm');
Route::when('recommendation/*', 'auth|confirm');
Route::when('messages', 'auth|confirm');
Route::when('messages/*', 'auth|confirm');

/* /URLs using confirm filter */





Route::filter('switchAPI',function(){
    $apiKey = Input::get('apiKey');
    if($apiKey != Helper::$apiKey)
        return "";  

});

Route::filter('auth', function()
{
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::json(false, 401);
        } else {
            return Redirect::guest('login');
        }
    }
});

0 个答案:

没有答案