I’m running a Joomla site running on a Plesk VPS with Apache + nginx. In the “Web Server Settings” in Plesk for that domain under “Additional nginx directives” (which will override the server-wide nginx configuration) I have specified:
add_header Cache-Control "private, max-age=604800, must-revalidate";
All works well and the site now gets served with proper cache headers added and Google PageSpeed stopped complaining – but I’m getting some errors with back-end functions now such as when uploading batches of images to my website’s gallery. This seems to be related to the above as it works normally again when the directive is removed.
How can I re-write the additional nginx directive above to exclude the /administrator/ directory of my site from having any cache headers added by nginx?
2
Answers
Use a location block that negates the path you don’t want the header added to:
If you have nginx+apache: