Bug: Multiple Expires
and Last-Modified
Headers in File Download Response
#9234
Labels
bug
Verified issues on the current code behavior or pull requests that will fix them
PHP Version
8.1
CodeIgniter4 Version
4.5.2
CodeIgniter4 Installation Method
Manual (zip or tar.gz)
Which operating systems have you tested for this bug?
macOS, Linux
Which server did you use?
apache
Database
mysql Ver 8.3.0 for macos14.2 on arm64 (Homebrew)
What happened?
While implementing a file download feature in a CodeIgniter 4 application, I encountered an issue where multiple
Expires
andLast-Modified
headers were being sent in the HTTP response. This problem occurred despite attempts to explicitly set these headers using the framework's response methods.Steps to Reproduce
Expected Output
Only one instance of each header should be sent in the response, specifically the ones set in the controller method.
Anything else?
As a workaround, the issue was resolved by using native PHP functions (
header()
andreadfile()
) to manage headers directly, bypassing CodeIgniter’s response handling. This provided complete control over the headers sent, eliminating the duplication issue.The text was updated successfully, but these errors were encountered: