def drop_vary_headers(response, headers_to_drop):
    if response.has_header('Vary'):
        vary_headers = cc_delim_re.split(response['Vary'])
    else:
        vary_headers = []

    headers_to_drop = [header.lower() for header in headers_to_drop]

    updated_vary_headers = []
    for header in vary_headers:
        if len(header):
            if header.lower() not in headers_to_drop:
                updated_vary_headers.append(header)

    if len(updated_vary_headers):
        response['Vary'] = ', '.join(updated_vary_headers)
    else:
        del response['Vary']
Remove an item from the "Vary" header of an ``HttpResponse`` object.
dataset/ETHPy150Open codysoyland/django-phased/phased/utils.py/drop_vary_headers