Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ColdFusion - how to set Content-Length header

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"> will set the header, but finding the right value is a problem.

Any pointers would be much appreciated.

like image 674
Geoff Avatar asked Oct 25 '22 04:10

Geoff


1 Answers

I believe I've solved it:

<cfheader name="Content-Length" value="#getPageContext().getCFOutput().getBuffer().size()#">

I stuck that in onRequestEnd() and the Cisco box is happily compressing away.

Thanks for the input folks.

like image 123
Geoff Avatar answered Nov 15 '22 12:11

Geoff