Creating Custom Headers¶
In some circumstances, you may need to set up a custom response header, such as a Cache-Control header or an Expire header. Here are a few examples to show you how it's done.
Browser Cache¶

Log in to the WebAdmin Console, navigate to Virtual Hosts > Context, and create a new context.
In the newly created context, set the Type to Static.

For our browser cache we want to target JavaScript and CSS files, so we can use regex to match all files of those types for the URI setting, like so:
exp:^.*(css|js)$
You can add more static file extensions, if you like, for example:
exp:^.*(css|gif|ico|jpeg|jpg|js|png|webp|woff|woff2|fon|fot|ttf)$
Set the following:
- Location:
$DOC_ROOT/$0(we need this$0because URI uses regex) - Accessible:
Yes - Enable Expire:
Yes
Set Expires by Type to the following (15552000 seconds equals 180 days):
application/javascript=A15552000, text/css=A15552000
You can add more types to Expires by Type if you like, for example:
text/css=A15552000, image/gif=A15552000, image/x-icon=A15552000, image/jpeg=A15552000, application/x-javascript=A15552000, text/javascript=A15552000, application/javascript=A15552000, image/png=A15552000, image/webp=A15552000, font/ttf=A15552000, font/woff=A15552000, font/woff2=A15552000, application/x-font-ttf=A15552000, application/x-font-woff=A15552000, application/font-woff=A15552000, application/font-woff2=A15552000
Set Header Operations to the following:
unset Cache-control
set Cache-control public, max-age=15552000
The unset cache-control line removes the previous cache control header, before the new one is set in the next line.
X-Powered-By¶
If more headers need to be added, the syntax and usage are similar to that of Apache's mod_headers directives for supported operations.
Here's an example that adds an X-Powered-By header:

Set the following:
- URl:
exp:^.*(css|js)$ - Location:
$DOC_ROOT/$0(we need this$0because URI uses regex) - Accessible:
Yes - Header Operations:
set X-Powered-By OpenLiteSpeed.
Security Headers¶
Please see our detailed Security Headers documentation.