diff --git a/www/nginx/pkg-descr b/www/nginx/pkg-descr
index d9fd96525..425b52555 100644
--- a/www/nginx/pkg-descr
+++ b/www/nginx/pkg-descr
@@ -14,6 +14,7 @@ Plugin Changelog
* add TCP load balancing [1]
* add support for IP based ACLs
* add log rotation (contributed by Julius Cesar Camargo [2]
+* add support for satisfy, body size limitation
* change: allow to disable internal bot protection (contributed by @fzoske) [3]
* change: do not save when no change in the list happened to prevent filling the log history
* fix: translate a german string in upstream server to english
diff --git a/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/forms/httpserver.xml b/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/forms/httpserver.xml
index cbcbaf368..5c5c9a4e8 100644
--- a/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/forms/httpserver.xml
+++ b/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/forms/httpserver.xml
@@ -34,6 +34,20 @@
text
+
+ httpserver.max_body_size
+
+ text
+ true
+ If the request is larger, it will be rejectet with error 413 (Request Entity Too Large). For example, you can enter 200m.
+
+
+ httpserver.body_buffer_size
+
+ text
+ true
+ If the request exceeds this size, it will be written to disk. Enter a number and a unit like 1m.
+ httpserver.certificate
@@ -83,7 +97,7 @@
httpserver.disable_bot_protectioncheckbox
- false
+ trueBlocks the request when a possibly bad bot is detected and adds the originating IP to the managed firewall alias for permanent blocking.
@@ -93,6 +107,14 @@
If you select an IP ACL, the client can only access this service if it fulfills this requirement.
+
+ httpserver.satisfy
+
+ dropdown
+ true
+
+ All: All access restrictions must be fulfilled; Any: Any of the access restrictions must be fulfilled.
+ httpserver.naxsi_extensive_log
diff --git a/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/forms/location.xml b/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/forms/location.xml
index 9334b1377..4072d2665 100644
--- a/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/forms/location.xml
+++ b/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/forms/location.xml
@@ -131,10 +131,26 @@
textEnter the file system root from which the files are served.
+
+ location.max_body_size
+
+ text
+ true
+ If the request is larger, it will be rejectet with error 413 (Request Entity Too Large). For example, you can enter 200m.
+
+
+ location.body_buffer_size
+
+ text
+ true
+ If the request exceeds this size, it will be written to disk. Enter a number and a unit like 1m.
+ location.indexselect_multiple
+ true
+
Enter a list of file extensions, which are served instead of a directory. It is common to use index.html or index.php here.
@@ -168,6 +184,14 @@
If you select an IP ACL, the client can only access this service if it fulfills this requirement.
+
+ location.satisfy
+
+ dropdown
+
+ true
+ All: All access restrictions must be fulfilled; Any: Any of the access restrictions must be fulfilled.
+ location.force_https
diff --git a/www/nginx/src/opnsense/mvc/app/models/OPNsense/Nginx/Nginx.xml b/www/nginx/src/opnsense/mvc/app/models/OPNsense/Nginx/Nginx.xml
index c17b20b4b..270fe1dfc 100644
--- a/www/nginx/src/opnsense/mvc/app/models/OPNsense/Nginx/Nginx.xml
+++ b/www/nginx/src/opnsense/mvc/app/models/OPNsense/Nginx/Nginx.xml
@@ -330,6 +330,16 @@
NY
+
+ N
+ /^\d+[kmg]$/i
+ Enter a number followed by k, m or g.
+
+
+ N
+ /^\d+[kmg]$/i
+ Enter a number followed by k, m or g.
+ Y0
@@ -354,6 +364,13 @@
NN
+
+
+ Any
+ All
+
+ N
+
@@ -594,6 +611,16 @@
NY
+
+ N
+ /^\d+[kmg]$/i
+ Enter a number followed by k, m or g.
+
+
+ N
+ /^\d+[kmg]$/i
+ Enter a number followed by k, m or g.
+
@@ -606,6 +633,13 @@
NN
+
+
+ Any
+ All
+
+ N
+
diff --git a/www/nginx/src/opnsense/service/templates/OPNsense/Nginx/http.conf b/www/nginx/src/opnsense/service/templates/OPNsense/Nginx/http.conf
index 9f6e65ba7..5560667a1 100644
--- a/www/nginx/src/opnsense/service/templates/OPNsense/Nginx/http.conf
+++ b/www/nginx/src/opnsense/service/templates/OPNsense/Nginx/http.conf
@@ -91,6 +91,15 @@ server {
error_log /var/log/nginx/{{ server.servername }}.error.log;
{% if server.root is defined and server.root != '' %}
root "{{server.root}}";
+{% endif %}
+{% if server.max_body_size is defined %}
+ client_max_body_size {{ server.max_body_size }};
+{% endif %}
+{% if server.body_buffer_size is defined %}
+ client_body_buffer_size {{ server.body_buffer_size }};
+{% endif %}
+{% if server.satisfy is defined %}
+ satisfy {{ server.satisfy }};
{% endif %}
#include tls.conf;
error_page 404 /opnsense_error_404.html;
diff --git a/www/nginx/src/opnsense/service/templates/OPNsense/Nginx/location.conf b/www/nginx/src/opnsense/service/templates/OPNsense/Nginx/location.conf
index a89e5a248..fcf496c37 100644
--- a/www/nginx/src/opnsense/service/templates/OPNsense/Nginx/location.conf
+++ b/www/nginx/src/opnsense/service/templates/OPNsense/Nginx/location.conf
@@ -47,6 +47,15 @@ location {{ location.matchtype }} {{ location.urlpattern }} {
{% if location.root is defined %}
root {{ location.root }};
{% endif %}
+{% if location.max_body_size is defined %}
+ client_max_body_size {{ location.max_body_size }};
+{% endif %}
+{% if location.body_buffer_size is defined %}
+ client_body_buffer_size {{ location.body_buffer_size }};
+{% endif %}
+{% if location.satisfy is defined %}
+ satisfy {{ location.satisfy }};
+{% endif %}
{% if location.index is defined %}
index {{ location.index.replace(",", " ") }};
{% endif %}
diff --git a/www/nginx/src/opnsense/www/js/nginx/src/nginx_config.js b/www/nginx/src/opnsense/www/js/nginx/src/nginx_config.js
index a3c9d11f5..ef28eed1c 100644
--- a/www/nginx/src/opnsense/www/js/nginx/src/nginx_config.js
+++ b/www/nginx/src/opnsense/www/js/nginx/src/nginx_config.js
@@ -23,15 +23,15 @@ const actioncollection = new Backbone.Collection([
function bind_save_buttons() {
// form save event handlers for all defined forms
$('[id*="save_"]').each(function () {
- $(this).click(function (event) {
+ $(this).click(function () {
let frm_id = $(this).closest("form").attr("id");
let frm_title = $(this).closest("form").attr("data-title");
// save data for General TAB
- saveFormToEndpoint(url = "/api/nginx/settings/set", formid = frm_id, callback_ok = function () {
+ saveFormToEndpoint("/api/nginx/settings/set", frm_id, function () {
// on correct save, perform reconfigure. set progress animation when reloading
$("#" + frm_id + "_progress").addClass("fa fa-spinner fa-pulse");
- ajaxCall(url = "/api/nginx/service/reconfigure", sendData = {}, callback = function (data, status) {
+ ajaxCall("/api/nginx/service/reconfigure", {}, function (data, status) {
// when done, disable progress animation.
$("#" + frm_id + "_progress").removeClass("fa fa-spinner fa-pulse");
@@ -116,7 +116,7 @@ $( document ).ready(function() {
// update history on tab state and implement navigation
if(window.location.hash !== "") {
- $('a[href="' + window.location.hash + '"]').click()
+ $('a[href="' + window.location.hash + '"]').click();
}
$('.nav-tabs a').on('shown.bs.tab', function (e) {
history.pushState(null, null, e.target.hash);
@@ -124,7 +124,7 @@ $( document ).ready(function() {
$('.reload_btn').click(function() {
$(".reloadAct_progress").addClass("fa-spin");
- ajaxCall(url="/api/nginx/service/reconfigure", sendData={}, callback=function(data,status) {
+ ajaxCall("/api/nginx/service/reconfigure", {}, function() {
$(".reloadAct_progress").removeClass("fa-spin");
});
});