Easy way to disable minification for certain calls?
-
Hey,
the plugin works great and I am more than happy with it. On one recent project I noticed a problem, however. Let’s say I have a page with a download button that triggers a POST action to a page that uses the following code to serve a downloadable zip file “$path” that is read from a (hidden from the user) file on the server and then output for forced download, like so:
header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($path)) . ' GMT'); header('Content-Type: application/force-download'); header('Content-Disposition: inline; filename="' . $filename . '.zip"'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($path)); header('Connection: close'); readfile($path); exit();
The minification plugin manages to output content before the headers (the minified page that the POST form sent to), and since this output content is included in the served zip file, it obviously breaks that file, although no page is rendered.
What would you reckon is a good way to exclude minification for these requests that don’t result in an actual page render? Is there some hook I can unhook the minification from for this particular download (i.e. if a particular POST param is present in the current request), which I have myself hooked in ‘init’?
- The topic ‘Easy way to disable minification for certain calls?’ is closed to new replies.