Nginx upstream prematurely closed connection while reading response header from upstream, for large requests

前端 未结 9 1035
無奈伤痛
無奈伤痛 2020-12-24 04:27

I am using nginx and node server to serve update requests. I get a gateway timeout when I request an update on large data. I saw this error from the nginx error logs :

<
9条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-24 05:04

    In my case, I tried to increase the timeout in the configuration file, but did not work. Later turned out it was working when filtering for less data to display on one page. In the views.py, I just added " & Q(year=2019)" to only display the data for the year 2019. BTW, a permanent fix would be using Pagination.

    def list_offers(request, list_type):
    context = {}
    context['list_type'] = list_type
    if list_type == 'ready':
        context['menu_page'] = 'ready'
        offer_groups = OfferGroup.objects.filter(~Q(run_status=OfferGroup.DRAFT) & Q(year=2019)).order_by('-year', '-week')
    
    context['grouped_offers'] = offer_groups
    
    return render(request, 'app_offers/list_offers.html', context)
    

提交回复
热议问题