请求期间内容长度标头丢失(django)

请求期间内容长度标头丢失(django),django,http,nginx,header,uwsgi,Django,Http,Nginx,Header,Uwsgi,使用 结果在响应头中只包含内容处置,而不包含内容长度 如果我添加一个无意义的标题,如 clen = os.path.getsize(the_file) response['content-disposition'] = "attachment; filename=%s" % filename response['content-length'] = clen return response 它完全出现在回答中。是否有其他地方正在覆盖标题或其他内容。我正在将ngi

使用

结果在响应头中只包含内容处置,而不包含内容长度 如果我添加一个无意义的标题,如

    clen = os.path.getsize(the_file)
    response['content-disposition'] = "attachment; filename=%s" % filename
    response['content-length'] = clen
    return response

它完全出现在回答中。是否有其他地方正在覆盖标题或其他内容。我正在将nginx与uwsgi一起使用。

当使用应用程序/八位字节流作为内容类型时,内容长度在标题中发送。

打印clen会产生一个有效(非零)长度它可能是您的nginx配置-例如nginx
    response['bla'] = 'some non-sense'