Create a custom folder and then copy the file:

Edit it:

Between |CONTEXTS| and |REALMS|, insert |CUSTOM3| and save.

Before writing the headers, make sure it belongs to the user diradmin:

Edit the file:

and add the following:

After adding the required headers, you must regenerate the domain configurations and restart OpenLiteSpeed:

Finally, it’s a good idea to hide the PHP version by editing the corresponding php.ini file:

 

You can check if your score has improved on the website securityheaders.com.

Source:
https://www.vpsbasics.com/cp/how-to-add-http-security-headers-with-openlitespeed-and-directadmin