Description | This article describes how to add includeSubDomains and/or set max-age for HTTP Strict Transport Security (HSTS) and is ONLY focusing on the needed setup for the Content Rewriting to add/modify the respective HSTS header. It is maybe necessary to preconfigure other respective Virtual Server setups and refer to the documentation at the end of this article for more information on configuring a Virtual Server. |
Scope | FortiADC and FortiADC VM. |
Solution |
It is necessary to have requirement to add includeSubDomains and/or set max-age for HTTP Strict Transport Security (HSTS) header.
From GUI:
Create Content Rewriting as below:
1) Add HSTS header with includeSubDomains and/or set max-age.
- Go to the Server Load Balance -> Virtual Server -> Content Rewriting (tab).
Note that for this example, 31536000 is used as the max-age value, set the value accordingly based on the requirement).
2) Delete HSTS header (optional). (This may be needed if the real server already included the HSTS header.)
- Go to the Server Load Balance -> Virtual Server -> Content Rewriting (tab).
Applies the Content Rewriting created in Step 1 at the respective Virtual Server.
From CLI:
Create Content Rewriting as below:
1) Add HSTS header with includeSubDomains and/or set max-age
# config load-balance content-rewriting
2) Delete the HSTS header (optional). (This may be needed if the real server already includes the HSTS header).
Applies the Content Rewriting created in Step 1 at the respective Virtual Server. (Note that the 'delete' content rewriting needs to be in front of the 'add' content rewriting).
# config load-balance virtual-server
Verification:
Before adding the HSTS header.
After adding the HSTS header.
Related Virtual Server configuration document: https://docs.fortinet.com/document/fortiadc/7.1.1/handbook/970956/configuring-virtual-servers
Related HSTS document: https://docs.fortinet.com/document/fortiadc/7.1.1/handbook/172527/hsts-and-hpkp-support |