diff --git a/src/etc/rc.php_ini_setup b/src/etc/rc.php_ini_setup
index 998ae5433..616111ca4 100755
--- a/src/etc/rc.php_ini_setup
+++ b/src/etc/rc.php_ini_setup
@@ -30,10 +30,21 @@ chmod 644 ${PHP_INI}
# Fetch the timezone from the XML and set it here
TIMEZONE=Etc/UTC
+ZLIB_COMPRESSION_LEVEL=""
if [ -f /conf/config.xml ]; then
TIMEZONE=`cat /conf/config.xml | egrep -E '(.*?)' | awk -F'>' '{print $2}'|awk -F'<' '{print $1}'`
+ ZLIB_COMPRESSION_LEVEL=`cat /conf/config.xml | egrep -E '(.*?)' | awk -F'>' '{print $2}'|awk -F'<' '{print $1}'`
fi
+# enable zlib compression on output processing when selected
+if [ -z "$ZLIB_COMPRESSION_LEVEL" ]; then
+ ZLIB_COMPRESSION_LEVEL=1
+ ZLIB_COMPRESSION="Off"
+else
+ ZLIB_COMPRESSION="On"
+fi
+
+
# Get a loaded module list in the stock php
# Populate a dummy php.ini to avoid
# the file being clobbered and the firewall
@@ -56,8 +67,8 @@ upload_tmp_dir = /tmp
upload_max_filesize = 200M
post_max_size = 200M
html_errors = Off
-zlib.output_compression = Off
-zlib.output_compression_level = 1
+zlib.output_compression = $ZLIB_COMPRESSION
+zlib.output_compression_level = $ZLIB_COMPRESSION_LEVEL
include_path = ".:/usr/local/etc/inc:/usr/local/www:/usr/local/opnsense/mvc:/usr/local/share/pear:/usr/local/opnsense/contrib"
ignore_repeated_errors = on
error_reporting = E_ALL ^ (E_NOTICE | E_DEPRECATED | E_STRICT)
diff --git a/src/www/system_advanced_admin.php b/src/www/system_advanced_admin.php
index 6a92e424e..48480e5fa 100644
--- a/src/www/system_advanced_admin.php
+++ b/src/www/system_advanced_admin.php
@@ -39,6 +39,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['webguiproto'] = $config['system']['webgui']['protocol'];
$pconfig['webguiport'] = $config['system']['webgui']['port'];
$pconfig['ssl-certref'] = $config['system']['webgui']['ssl-certref'];
+ $pconfig['webuicompression'] = isset($config['system']['webgui']['webuicompression']) ? $config['system']['webgui']['webuicompression'] : null;
if (!empty($config['system']['webgui']['ssl-ciphers'])) {
$pconfig['ssl-ciphers'] = explode(':', $config['system']['webgui']['ssl-ciphers']);
} else {
@@ -98,6 +99,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($config['system']['webgui']['protocol'] != $pconfig['webguiproto'] ||
$config['system']['webgui']['port'] != $pconfig['webguiport'] ||
$config['system']['webgui']['ssl-certref'] != $pconfig['ssl-certref'] ||
+ $config['system']['webgui']['webuicompression'] != $pconfig['webuicompression'] ||
$config['system']['webgui']['ssl-ciphers'] != $newciphers ||
($pconfig['disablehttpredirect'] == "yes") != !empty($config['system']['webgui']['disablehttpredirect'])
) {
@@ -110,6 +112,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$config['system']['webgui']['port'] = $pconfig['webguiport'];
$config['system']['webgui']['ssl-certref'] = $pconfig['ssl-certref'];
$config['system']['webgui']['ssl-ciphers'] = $newciphers;
+ $config['system']['webgui']['webuicompression'] = $pconfig['webuicompression'];
if ($pconfig['disablehttpredirect'] == "yes") {
$config['system']['webgui']['disablehttpredirect'] = true;
@@ -485,6 +488,28 @@ include("head.inc");
+
+
=gettext("WebGui Compression")?>
+
+
+
+ =gettext("Enable compression of webgui pages and dynamic content (transfer less data to the client for an additional cost in processing power).") ?>
+