File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed
Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,8 @@ x-frame-options: SAMEORIGIN
146146x-xss-protection: 0
147147referrer-policy: origin
148148
149+
150+
149151=== TEST 8: X-Frame-Options should not be sent for CSS (even when encoding specified)
150152--- config
151153 security_headers on;
@@ -162,3 +164,64 @@ hello world
162164--- response_headers
163165content-type: text/css; charset=utf-8
164166!x-frame-options
167+
168+
169+
170+ === TEST 9: hides common powered-by headers
171+ --- config
172+ location = /hello {
173+ security_headers on;
174+
175+ add_header X-Powered-By "PHP/8.2";
176+ add_header X-Generator "WordPress 6.5";
177+ add_header X-Jenkins "2.440";
178+ add_header X-Something-Custom "Visible";
179+ return 200 "hello world\n";
180+ }
181+ --- request
182+ GET /hello
183+ --- response_body
184+ hello world
185+ --- response_headers
186+ !x-powered-by
187+ !x-generator
188+ !x-jenkins
189+ x-something-custom: Visible
190+
191+
192+
193+ === TEST 10: headers are visible when security_headers is off
194+ --- config
195+ location = /hello {
196+ # security_headers off (по умолчанию)
197+ add_header X-Powered-By "PHP/8.2";
198+ add_header X-Generator "WordPress";
199+ return 200 "hello world\n";
200+ }
201+ --- request
202+ GET /hello
203+ --- response_body
204+ hello world
205+ --- response_headers
206+ x-powered-by: PHP/8.2
207+ x-generator: WordPress
208+
209+
210+
211+ === TEST 11: only hide server header
212+ --- config
213+ hide_server_tokens on;
214+ location = /hello {
215+ add_header Server "nginx";
216+ add_header X-Powered-By "PHP";
217+ add_header X-Generator "Drupal";
218+ return 200 "hello world\n";
219+ }
220+ --- request
221+ GET /hello
222+ --- response_body
223+ hello world
224+ --- response_headers
225+ !server
226+ x-powered-by: PHP
227+ x-generator: Drupal
You can’t perform that action at this time.
0 commit comments