Response headers hold additional information about the response, like its location or about the server providing it. With caching plugins, though, custom response headers may not be included, which can cause issues with the website itself.
A use case can be that non-standard headers, such as ones set through some security plugins, may be lost during the optimization process if the plugin loads later on and they are not present at the beginning.
Luckily, NitroPack has a feature called “Must include headers” that forces NitroPack to check for the headers during the optimization process and preserve them.
Test case and How To Fix It
A classic use case for the issue is the “cache-control” header being altered when NitroPack optimizes a page. For the test website, the cache-control header has values “no-cache, no-store, no-cache, must-revalidate”, but when the website is optimized, the cache-control header only has a value “no-cache”:
To resolve the issue and preserve the values of the cache-control header, the header itself is added to the “Must include headers” feature:
After the settings are saved and the website’s cache is purged and re-optimized, the proper values of the cache-control headers are preserved:
📌 If you need any assistance or have questions, reach out to our support team at [email protected] or via this link: https://support.nitropack.io