Setting Up Custom Headers
In some circumstance a user may need to set up a custom header, such as a Cache-Control header or an Expire header.
Log in to the WebAdmin Console via
https://IP:7080, go to Virtual Hosts > Context, and create a new context.
In the newly created context, set Type to
Since the targeted files are JS and CSS, use regex to match all files of those types for URI, like so:
You can add more static file extensions, if you like, for example:
Set Location to
$DOC_ROOT/$0. We need the
$0 because URI uses regex.
Set Accessible to
Set Enable Expire to
Set Expires by Type to the following (
15552000 seconds equals 180 days):
Set Header Operations to the following:
unset Cache-control set Cache-control public, max-age=15552000
unset cache-control line removes the previous cache control header, before the new one is set in the next line.
Save and restart.
You can look for the new response header from the browser’s development tool.
Adding Custom Headers
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
The verified result: