clear response header info in coldfusion

I need clear the response headers before my page is sent. How do i do that in coldfusion?

Here is the background to my problem:

http://blogs.msdn.com/b/ieinternals/archive/2009/10/03/internet-explorer-cannot-download-over-https-when-no-cache.aspx

I know what I need to do, but I haven't been able to find a way to clear the response headers.

attached is the response header from Fidler.
 FidlerHeader
These two lines need to be removed. They come from the header.cfm page (which is automatically included implicitly from what I can tell). These lines have not been added in the page I am working with:
cache-control: private, no-store, must-revalidate
pragma: private


These lines are the ones I need to keep and have been added to the page I am working with:
cache-control: private, max-age=15
pragma:


How do I get rid of the first two lines before adding the second two.

so basically I want to:

clear the cache-control values
clear the pragma values

<cfheader name="cache-control" value="private, max-age=15">
<cfheader name="pragma" value="">

Thanks for your help
AWEInCAAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

_agx_Commented:
Have you tried doing a reset() before the new headers?

<!--- this will throw an error if the response has already been committed --->
<cfset getPageContext().getResponse().reset()>
<cfheader name="cache-control" value="private, max-age=15">
<cfheader name="pragma" value="private">
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
_agx_Commented:
Correction, omit the pragma header entirely since you want to clear it

ie
<!--- this will throw an error if the response has already been committed --->
<cfset getPageContext().getResponse().reset()>
<cfheader name="cache-control" value="private, max-age=15">
0
AWEInCAAuthor Commented:
<cfset getPageContext().getResponse().reset()> didn't work

 after trying <cfset getPageContext().getResponse().reset()>

Any other suggestions or advice?

Thanks again for your help
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

_agx_Commented:
It seemed to work in limited tests.  Where is header.cfm being included and where is your reset() call in relation to the include and the rest of the code ?  Also what's your webserver?
0
AWEInCAAuthor Commented:
I've been handed this application and know little about coldfusion.

I haven't been able to figure out where/how the header.cfm is being included. I'm guessing it is automatically included in all pages because file is named  header.cfm.

I don't have access to the webserver. I have to give the files to another person.

As with the article in my original post, The problem doesn't happen if I am using ColdFusion as the webserver. It only happens if IIS is serving the pages.

Here is the code snippet where I want to change the header info:


<cfset getPageContext().getResponse().reset()>

<cfheader name="cache-control" value="private, max-age=15">

<cfheader  name="Content-Disposition" value="attachment; filename=pdf_#session.cfid#_#session.cftoken#.pdf">

<cfcontent reset="yes" type="application/octet-stream" />

<cfcontent type="application/pdf" file="#GetDirectoryFrompath(GetBAseTemplatePath())#reports/concatenatedPDF.pdf" deletefile="Yes">

Open in new window

0
AWEInCAAuthor Commented:

OK the header.cfm is being included in the Application file.  I've excluded the page I am working with.

Testing now. Will update you in a bit.

Thanks again for your help
0
_agx_Commented:
> I haven't been able to figure out where/how the header.cfm is being included
Usually it would be included in your Application file.  It's a special file that runs on every request.  It could be named either Application.cfc (newer format) or Application.cfm (older format).  It'll either be in the same folder as your download script or one of it's parent folders.

> The problem doesn't happen if I am using ColdFusion as the webserver.
> It only happens if IIS is serving the pages.

You mean the built in CF web server JRun? If you're talking about 2 different servers are you sure it's CF adding the headers and not IIS?
0
_agx_Commented:
Ooops.. I got called away. Should have refreshed before posting :)  

Ignore my last response.  I see figured out the Application stuff.
0
AWEInCAAuthor Commented:

After I excluded the header.cfm, the response headers are correct now and the download is working.

>"You mean the built in CF web server JRun? If you're talking about 2 different servers are you sure it's CF adding the headers and not IIS?"
I use CF to serve the pages on my dev server and the problem doesn't exist. Apparently one of the production servers uses IIS to serve the pages. IE wouldn't cache the page for downloading if the page was coming from IIS, and I would get the error.

Thanks so much for your help.

It would be interesting to know how to actually clear the response headers before sending new ones as described in the OP. But I am very happy to be able to move on to something else.

0
_agx_Commented:
> It would be interesting to know how to actually clear the response headers before sending new ones

Well that's what the reset() does. From the docs:
    "Clears any data that exists in the buffer as well as the status code and headers. "

So it definitely should work with Jrun as long as you do the reset() after the include headers.cfm.  If it's not working under IIS, maybe IIS is modifying the headers afterward?
0
AWEInCAAuthor Commented:
oops. Not sure how to change the 'Best Solution'  the assisted solution is the one that actually worked
0
_agx_Commented:
I don't open a lot of questions so I'm not entirely clear on how that feature works. I used to think you could pick the "best answer" manually. But it's possible it's chosen automatically when 2 answers have the same number of points assigned.  You can always ask the moderators in Community Support.  I'm sure they'd know. Just use "Request Attention" link.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.