ColdFusion - 如何设置 Content-Length 标头 [英] ColdFusion - how to set Content-Length header
问题描述
是否有人成功地将 Content-Length 标头添加到常规 ColdFusion(我使用的是 CF9)页面?我正在 Cisco 负载均衡器后面设置一个带有压缩功能的新服务器 - 该框拒绝压缩没有此标头的任何内容,但默认情况下 CF 不会通过它.
Has anyone successfully added a Content-Length header to regular ColdFusion (I'm using CF9) pages? I'm setting up a new server behind a Cisco load balancer with compression - the box refuses to compress anything without this header, but CF doesn't pass it by default.
<cfheader name="Content-Length" value="something">
会设置标题,但是找到正确的值是个问题.
<cfheader name="Content-Length" value="something">
will set the header, but finding the right value is a problem.
任何指针将不胜感激.
推荐答案
我相信我已经解决了:
<cfheader name="Content-Length" value="#getPageContext().getCFOutput().getBuffer().size()#">
我把它卡在 onRequestEnd()
中,Cisco 盒子很高兴地压缩了.
I stuck that in onRequestEnd()
and the Cisco box is happily compressing away.
感谢大家的投入.
这篇关于ColdFusion - 如何设置 Content-Length 标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!