waf http-header-security
Use this command to insert special HTTP response headers to protect clients from certain attacks, including XSS, clickjacking, and MIME sniffing attacks. The special HTTP response headers define security policies to client browsers so that the browsers avoid exposure to known vulnerabilities when handling requests.
For more information on HTTP Header Security, see the FortiWeb Administration Guide:
https://docs.fortinet.com/document/fortiweb
To use this command, your administrator account’s access control profile must have either w or rw permission to the admingrp area. For details, see Permissions.
Syntax
config waf http-header-security
edit "<HTTP-header-security_name>"
config HTTP-header-security-list
set value {nosniff | allow-from | deny | sameorigin | sanitizing-mode | block-mode}
set allow-from-source "<allow-from_str>"
set request-type {plain | regular}
set request-file "<request-file_str>"
set request-status {enable | disable}
set client-ip-filter-status {enable | disable}
set client-ip < client ip_range>
set header-filter-status {enable | disable}
set header-filter-name <header name>
set header-filter-type {plain | regular}
set header-filter-value <header value>
next
end
next
end
| Variable | Description | Default |
| Enter of name of an HTTP header security policy. The maximum length is 63 characters. | No default. | |
| Enable to set a URL Filter. | disable
|
|
|
Defines the Request URL Type as a simple string (plain) or a regular expression (regular) for the URL Filter. Available only if request-status {enable | disable} is set to |
No default. | |
|
Sets the Request URL for the URL Filter. Available only if request-status {enable | disable} is set to |
No default. | |
| Creates or edits a Secure Header Rule in the selected HTTP Header Security Policy. | No default. | |
|
name {x-frame-options | x-content-type-options | x-xss-protection | content-security-policy | feature-policy | permissions-policy | referrer-policy | cross-origin-resource-policy | cross-origin-embedder-policy | cross-origin-opener-policy | clear-site-data | timing-allow-origin | content-security-policy-report-only} |
Specifies the HTTP security header type to configure in this Secure Header Rule. The following types are supported:
|
No default. |
|
value {nosniff | allow-from | deny | sameorigin | sanitizing-mode | block-mode} |
Defines the response according to the defined Secure Header Type. The
The
The
|
No default. |
Sets the specified domain if the name {x-frame-options | x-content-type-options | x-xss-protection | content-security-policy | feature-policy | permissions-policy | referrer-policy | cross-origin-resource-policy | cross-origin-embedder-policy | cross-origin-opener-policy | clear-site-data | timing-allow-origin | content-security-policy-report-only} is x-frame-options and the Header Value is set to allow-from. |
No default. | |
| client-ip-filter-status {enable | disable} | Enable this to restrict the security header to specific client IP addresses. |
|
| If the IP Filter is enabled, specify the single IP or range of addresses that should trigger the header. |
No default. |
|
|
Enable this to trigger the security header based on the presence or value of an incoming request header. |
|
|
Enter the name of the incoming HTTP header to check (e.g., Cookie). |
No default. |
|
| header-filter-type {plain | regular} |
Choose between plain for exact matches or Regular for advanced pattern matching. |
|
|
Enter the specific value that must be matched in the request header to trigger the security response. |
No default. |
Example
This example creates a HTTP header security policy.
config waf HTTP-header-security
edit HTTP_header_security1
set request-status enable
set request-type plain
set request-file "/bWAPP/clickjacking.php"
config HTTP-header-security-list
edit 1
set name x-content-type-options
set value nosniff
next
edit 2
set name x-frame-options
set value deny
next
edit 3
set name x-xss-protection
set value block-mode
next
next
end