Expires header - with variable value or without break
Igor Sysoev
is at rambler-co.ru
Tue Aug 12 11:27:16 MSD 2008
On Mon, Aug 11, 2008 at 08:57:09PM +0200, Rob Dupuis wrote:
> 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
The expires directive does not support varaibles.
All these nginx's if's and break's are ugly constructions.
Do you want set max expires for URLs like "/some.gif?ts_anything" ?
Should these URLs proxied to app_servers ?
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list