3 # Phase 1 (request headers)
9 SecRequestBodyAccess On
10 SecResponseBodyAccess On
11 SecResponseBodyMimeType text/plain null
12 SecRule REQUEST_LINE "^POST" "phase:1,pass,log,auditlog"
13 SecRule ARGS "val1" "phase:1,pass,log,auditlog"
14 SecRule RESPONSE_HEADERS:Last-Modified "." "phase:1,pass,log,auditlog"
15 SecRule RESPONSE_BODY "TEST" "phase:1,pass,log,auditlog"
18 error => [ qr/Pattern match "\^POST" at REQUEST_LINE/, 1 ],
19 -error => [ qr/Pattern match .* (ARGS|RESPONSE)/, 1 ],
24 request => new HTTP::Request(
25 POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
27 "Content-Type" => "application/x-www-form-urlencoded",
29 "arg1=val1&arg2=val2",
33 # Phase 2 (request body)
39 SecRequestBodyAccess On
40 SecResponseBodyAccess On
41 SecResponseBodyMimeType text/plain null
42 SecRule REQUEST_LINE "^POST" "phase:2,pass,log,auditlog"
43 SecRule ARGS "val1" "phase:2,pass,log,auditlog"
44 SecRule RESPONSE_HEADERS:Last-Modified "." "phase:2,pass,log,auditlog"
45 SecRule RESPONSE_BODY "TEST" "phase:2,pass,log,auditlog"
48 error => [ qr/Pattern match "\^POST" at REQUEST_LINE.*Pattern match "val1" at ARGS/s, 1 ],
49 -error => [ qr/Pattern match .* RESPONSE/, 1 ],
54 request => new HTTP::Request(
55 POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
57 "Content-Type" => "application/x-www-form-urlencoded",
59 "arg1=val1&arg2=val2",
63 # Phase 3 (response headers)
69 SecRequestBodyAccess On
70 SecResponseBodyAccess On
71 SecResponseBodyMimeType text/plain null
72 SecRule REQUEST_LINE "^POST" "phase:3,pass,log,auditlog"
73 SecRule ARGS "val1" "phase:3,pass,log,auditlog"
74 SecRule RESPONSE_HEADERS:Last-Modified "." "phase:3,pass,log,auditlog"
75 SecRule RESPONSE_BODY "TEST" "phase:3,pass,log,auditlog"
78 error => [ qr/Pattern match "\^POST" at REQUEST_LINE.*Pattern match "val1" at ARGS.*Pattern match "\." at RESPONSE_HEADERS/s, 1 ],
79 -error => [ qr/Pattern match .* RESPONSE_BODY/, 1 ],
84 request => new HTTP::Request(
85 POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
87 "Content-Type" => "application/x-www-form-urlencoded",
89 "arg1=val1&arg2=val2",
93 # Phase 4 (response body)
99 SecRequestBodyAccess On
100 SecResponseBodyAccess On
101 SecResponseBodyMimeType text/plain null
102 SecDebugLog "$ENV{DEBUG_LOG}"
104 SecRule REQUEST_LINE "^POST" "phase:4,pass,log,auditlog"
105 SecRule ARGS "val1" "phase:4,pass,log,auditlog"
106 SecRule RESPONSE_HEADERS:Last-Modified "." "phase:4,pass,log,auditlog"
107 SecRule RESPONSE_BODY "TEST" "phase:4,pass,log,auditlog"
110 error => [ qr/Pattern match "\^POST" at REQUEST_LINE.*Pattern match "val1" at ARGS.*Pattern match "\." at RESPONSE_HEADERS.*Pattern match "TEST" at RESPONSE_BODY/s, 1 ],
115 request => new HTTP::Request(
116 POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
118 "Content-Type" => "application/x-www-form-urlencoded",
120 "arg1=val1&arg2=val2",
127 comment => "phase 5",
130 SecRequestBodyAccess On
131 SecResponseBodyAccess On
132 SecResponseBodyMimeType text/plain null
133 SecRule REQUEST_LINE "^POST" "phase:5,pass,log,auditlog"
134 SecRule ARGS "val1" "phase:5,pass,log,auditlog"
135 SecRule RESPONSE_HEADERS:Last-Modified "." "phase:5,pass,log,auditlog"
136 SecRule RESPONSE_BODY "TEST" "phase:5,pass,log,auditlog"
139 error => [ qr/Pattern match "\^POST" at REQUEST_LINE.*Pattern match "val1" at ARGS.*Pattern match "\." at RESPONSE_HEADERS.*Pattern match "TEST" at RESPONSE_BODY/s, 1 ],
144 request => new HTTP::Request(
145 POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
147 "Content-Type" => "application/x-www-form-urlencoded",
149 "arg1=val1&arg2=val2",