mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-15 17:12:14 +03:00
nginx refactoring
Refactoring on the nginx module, including: - Better handling larger posts; - Now using nginx echo module during the regression tests. - Better interacting with neginx chain rules - Separation of the request handling and content filters. - Better handling nginx sessions and resource counts to allow a more efficient garbage collector. - Handling both http/1.0 and 1.1, including keep-alive. - Tests are now capable to test nginx as a proxy or end-server. - Tested agains nginx 1.6 and 1.7.
This commit is contained in:
@@ -71,7 +71,7 @@
|
||||
SecResponseBodyMimeType text/plain null
|
||||
SecRule REQUEST_LINE "^POST" "phase:3,pass,log,auditlog,id:500177"
|
||||
SecRule ARGS "val1" "phase:3,pass,log,auditlog,id:500178"
|
||||
SecRule RESPONSE_HEADERS:Last-Modified "." "phase:3,pass,log,auditlog,id:500179"
|
||||
SecRule RESPONSE_HEADERS:Content-type "." "phase:3,pass,log,auditlog,id:500179"
|
||||
SecRule RESPONSE_BODY "TEST" "phase:3,pass,log,auditlog,id:500180"
|
||||
),
|
||||
match_log => {
|
||||
@@ -103,7 +103,7 @@
|
||||
SecDebugLogLevel 9
|
||||
SecRule REQUEST_LINE "^POST" "phase:4,pass,log,auditlog,id:500181"
|
||||
SecRule ARGS "val1" "phase:4,pass,log,auditlog,id:500182"
|
||||
SecRule RESPONSE_HEADERS:Last-Modified "." "phase:4,pass,log,auditlog,id:500183"
|
||||
SecRule RESPONSE_HEADERS:Content-Type "." "phase:4,pass,log,auditlog,id:500183"
|
||||
SecRule RESPONSE_BODY "TEST" "phase:4,pass,log,auditlog,id:500184"
|
||||
),
|
||||
match_log => {
|
||||
@@ -132,7 +132,7 @@
|
||||
SecResponseBodyMimeType text/plain null
|
||||
SecRule REQUEST_LINE "^POST" "phase:5,pass,log,auditlog,id:500185"
|
||||
SecRule ARGS "val1" "phase:5,pass,log,auditlog,id:500186"
|
||||
SecRule RESPONSE_HEADERS:Last-Modified "." "phase:5,pass,log,auditlog,id:500187"
|
||||
SecRule RESPONSE_HEADERS:Content-type "." "phase:5,pass,log,auditlog,id:500187"
|
||||
SecRule RESPONSE_BODY "TEST" "phase:5,pass,log,auditlog,id:500188"
|
||||
),
|
||||
match_log => {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
status => qr/^403$/,
|
||||
},
|
||||
request => new HTTP::Request(
|
||||
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/index.html",
|
||||
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
|
||||
[
|
||||
"Content-Type" => "application/x-www-form-urlencoded",
|
||||
],
|
||||
@@ -46,7 +46,7 @@
|
||||
status => qr/^200$/,
|
||||
},
|
||||
request => new HTTP::Request(
|
||||
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/index.html",
|
||||
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
|
||||
[
|
||||
"Content-Type" => "application/x-www-form-urlencoded",
|
||||
],
|
||||
@@ -73,7 +73,7 @@
|
||||
status => qr/^403$/,
|
||||
},
|
||||
request => new HTTP::Request(
|
||||
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/index.html",
|
||||
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
|
||||
[
|
||||
"Content-Type" => "application/x-www-form-urlencoded",
|
||||
],
|
||||
@@ -100,7 +100,7 @@
|
||||
status => qr/^200$/,
|
||||
},
|
||||
request => new HTTP::Request(
|
||||
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/index.html",
|
||||
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
|
||||
[
|
||||
"Content-Type" => "application/x-www-form-urlencoded",
|
||||
],
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
|
||||
user root;
|
||||
worker_processes 1;
|
||||
worker_processes 1;
|
||||
daemon on;
|
||||
error_log logs/error.log debug;
|
||||
worker_rlimit_core 500M;
|
||||
working_directory /tmp/;
|
||||
error_log logs/error.log debug;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
@@ -10,13 +12,42 @@ events {
|
||||
http {
|
||||
ModSecurityEnabled [% enable %];
|
||||
ModSecurityConfig [% config %];
|
||||
server {
|
||||
client_body_buffer_size 1024M;
|
||||
|
||||
server {
|
||||
client_max_body_size 30M;
|
||||
listen [% listen %];
|
||||
server_name localhost;
|
||||
location / {
|
||||
error_page 405 = $uri;
|
||||
|
||||
|
||||
|
||||
location /no-proxy/test.txt {
|
||||
echo "TEST";
|
||||
}
|
||||
|
||||
location /no-proxy/test2.txt {
|
||||
echo "TEST 2";
|
||||
}
|
||||
|
||||
location /proxy/test.txt {
|
||||
proxy_pass http://localhost:[% listen %]/more/test.txt;
|
||||
}
|
||||
|
||||
location /proxy/test2.txt {
|
||||
proxy_pass http://localhost:[% listen %]/more/test2.txt;
|
||||
}
|
||||
|
||||
location /test.txt {
|
||||
echo "TEST";
|
||||
}
|
||||
|
||||
location /test2.txt {
|
||||
echo "TEST 2";
|
||||
}
|
||||
|
||||
location / {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user