Using REST APIs
These REST APIs can be used to set HSTS headers.
This REST call will get the current properties.
curl -X GET --digest -u admin:admin \ "http://localhost:8002/manage/v2/servers/test/properties?group-id=Default"
This REST call enables the HSTS header and sets the HSTS max age.
curl -X PUT --digest -u admin:admin -H "Content-type: application/json"\ -d '{"enable-hsts-header":true, "hsts-header-max-age":31536000}'\ "http://localhost:8002/manage/v2/servers/test/properties?group-id=Default"
The max age amount is being set to 31,536,000 or one year.