Skip to main content

How to overcome Add Expires Headers on a NGINX Server?

Comments

3 comments

  • 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.
    0
  • 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
    0
  • 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.
    0

Please sign in to leave a comment.