title: Nginx setting expires header with proxy
body: <p>I have the following base Nginx configuration (pre-installed Ghost platform on DigitalOcean droplet):</p>
  
  <pre><code>server {
      listen 80;                                                             
      server_name xxx.com;
  
      client_max_body_size 10M;
  
      location / {
          proxy_pass http://localhost:2368/;
          proxy_set_header Host $host;
          proxy_buffering off;
      }
  }
  </code></pre>
  
  <p>Now I tried to set the following expiry header for my assets but without success:</p>
  
  <pre><code>location ~ ^/assets/ {
      expires 30d;
      add_header Pragma public;
      add_header Cache-Control "public";
  }
  </code></pre>
  
  <p>Based on the information I've found, Nginx only uses one location path at a time so have to copy the proxy_* parameters inside the assets location block. If I just copy them I get an error (regex with proxy_pass) that can be solved by rewriting the URL before passing it to the proxy. I already did some experiments with that but I don't get it to work either.</p>
  
  <p>Does anyone have an example of how to set expiry headers when a proxy_pass is present? I simply want all files under xxx.com/assets/ to have the proper expiry date.</p>