Hi, all.
I was trying to implement a "download link" and put it beside one of my report table so that users can download a csv file and open it with applications like Excel.
The records are generated dynamically based on the query made by users.
So somewhere in my controller there's something like:
response.headers['Content-Type'] = 'text/csv'
response.headers['Content-Disposition'] = 'attachment; filename=xxx.csv'
return response.stream(dynamically_generated_csv, request=request)
This works in both FireFox & Chrome, but fails in IE.
When I print out the response headers, I found that several headers were added to my response by web2py:'Expires', 'Cache-Control', etc...
And when I remove the 'Cache-Control' header by doing the following:
del response.headers['Cache-Control']
It works in IE.
So it seems like IE has trouble dealing with a downloadable file with 'Cache-Control' set to certain value.
Now, my question is:
Why does web2py add these response headers, implicitly? and maybe without a way to set it off?
is there any side effect when i delete the 'Cache-Control' header this way?
Thanks in advance.