How to manually add Strict-Transport-Security to your openlitespeed.conf file

  context / {
    type    Static
    ExtraHeaders    Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
  }

Took hours to figure it out, but it finally works. Don’t know which custom file to make so it adds it under the context, probably need a DirectAdmin update.

I only did that for one subdomain. If you run “curl -i https://sub.domain.com/”, it’ll say “strict-transport-security: max-age=15552000; includeSubDomains”, if it’s working.

Their documentation is horrible, it’s for the web interface, that is disabled, enabling it doesn’t work.

Update
Add the below to “/usr/local/directadmin/data/templates/custom/cust_openlitespeed.CUSTOM.post”, create it if it doesn’t exist.

  |*if SSL_TEMPLATE="1"|
  context / {
    type    Static
    ExtraHeaders    Header always set Strict-Transport-Security "max-age=155520$
  }
  |*endif|

Guess more then one conext / doesn’t matter. That’ll add it to the top of the vhost config. Apparently the order of stuff doesn’t matter.