Expires header - with variable value or without break

Rob Dupuis lists at ruby-forum.com
Mon Aug 11 22:57:09 MSD 2008


Hi.

I'm trying to sort out expires headers for my rails app.

I'm trying two approaches, neither of which seem to work:

----------
Approach 1 - (simple expires in if block):

location / {

  if ( $request_uri ~* \.(css|js|gif|jpe?g|png|ico|htc)\?ts_ ) {
    expires max;
  }

  if (-f $request_filename) {
    break;
  }

  proxy_pass http://app_servers;
}

This doesn't work at all unless I put a break; within the if block (same
problem as: http://www.ruby-forum.com/topic/129953)

----------
Approach 2 - (set expires variable into a variable):

location / {
  set $expires_value -1;

  if ( $request_uri ~* \.(css|js|gif|jpe?g|png|ico|htc)\?ts_ ) {
    set $expires_value max;
  }

  if (-f $request_filename) {
    expires $expires_value;
    break;
  }

  proxy_pass http://app_servers;
  expires $expires_value;
  break;
}

This gives me an emerg message: "expires" directive invalid value in
conf_file

Can anyone help with this?
Thanks, Rob
-- 
Posted via http://www.ruby-forum.com/.





More information about the nginx mailing list