Actually I just found out the answer. It seems that if you use sessions in PHP with SSL, this problem arises.
Basically, you have to send more headers.
header("Content-Type: WHATEVER_YOU_LIKE");
header("Content-Disposition: inline; filename=\"excel.xls\"");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
And it works great!