mercredi 13 janvier 2021

Laravel 502 Proxy Error on specific route call

I am having a problem specific to the production code. On said server, everytime I try to access specific route which is supposed to show a table of all categories I get a 502 Proxy Error:

Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request

Reason: Error reading from remote server

I have found some common problem on the internet already, however all of those were for users who use nginx. I use Laragon. Also, Laravel version is 5.5.21

As I said the problem is production code only. It is not happening when I run it locally.

I also tried to download laravel.log file from the server, but there was nothing there.

This is the function that is being called by route:

public function index(){
        if(empty(request()->query()) && session()->exists('categories_filter')){
            return redirect(route('categories.index').'?'.http_build_query(session()->pull('categories_filter')));
        }

        if(!empty(request()->query())){
            $this->store_filter();
        }

        $categories = Category::orderBy($this->sort, $this->order);

        if($name_sk = request('name_sk')){
            $categories = $categories->where('name_sk', 'like', "%{$name_sk}%");
        }

        $categories = $categories->paginate(20);
        $all_categories = Category::with('children')->get();

        $sort = $this->sort;
        $order = $this->order;
        $new_order = $this->new_order;

        return view('admin.categories.index', compact('categories', 'sort', 'order', 'new_order', 'all_categories'));
    }

I honestly have no idea where the problem lies or what is its cause.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire