I have a CI controller that outputs some JS variables (mainly language variables). I set the MIME type using header function, etc. So, it’s really JS when it’s outputted.
Looking at the header responses, I see session data being returned. As an optimization, I would like to prevent that from being returned (saved a few bytes). Is there a way for me to do this?
For my regular JS, CSS, etc. files, I put them on a sub-domain that does not set session/cookies. But since JS this is coming from my application’s controller, it has session data.
As long as headers (which cookies are) have not been sent already, the
header_removefunction can be used to remove them before they are send to the browser.It might be that this makes especially sense as codeigniter sends all session data as a round-trip.
To inspect outgoing headers, PHP’s
headers_listfunction is handy.