Skip to main content
cPanel Technical Support has been heavily impacted by hurricane Beryl and our ability to respond to tickets has been hindered as a result. We appreciate your understanding and patience as we address these delays.

How to overcome Add Expires Headers on a NGINX Server?



  • cPanelThomas
    Howdy, Are you sure there isn't any other block in configuration that might later be matching those same URLs and applying an expires header of 56d? As is, I don't really see anything off the top of my head that would make these conditions not match for URLs they would appear to match other than missing context. Apologies in advance if I misunderstand you. Perhaps it would be of value for you to use a location match configuration tester website for your NGINX configuration? Several exist online that I saw when looking around in response to your posting here (search term "nginx location match tester"). Also, as a side note, are you sure the `Expires` header is the best approach here for static content? Generally this is considered an outdated technique for ensuring static content gets cached compared to using Cache-control
    headers with max-age
    set. I say this because modern browsers will in fact ignore the Expires
    header in favor of this other technique when both are present in response headers.
  • toplisek
    Can you inform us about official steps to make NGINX settings inside cPanel which will not break website? I see it is limited setting: NGINX with Reverse Proxy | cPanel & WHM Documentation
  • cPRex Jurassic Moderator
    The "Configuration files" link at NGINX with Reverse Proxy | cPanel & WHM Documentation gives more detail on how you can edit the configuration in a way that will not get overwritten by cPanel updates.

Please sign in to leave a comment.