Welcome! Log In Create A New Profile

Advanced

understanding break and add_header combo

May 02, 2013 11:53AM
Hello,

I'm trying to undestand the break; statement in combination with add_header combo, on the wiki it says the following:

"Completes the current set of rules. Continue processing within the current location block but do not process any more rewrite directives."

I read this as everything that has todo with the HttpRewriteModule will not be processed any more after this statement. I have the following piece of config for a rails app:


server {

listen 80;

server_name x;

root /var/www/vhost/x/current/public;
passenger_enabled on;

location ~ ^/assets/ {
expires 1y;
add_header Cache-Control public;

# Some browsers still send conditional-GET requests if there's a
# Last-Modified header or an ETag header even if they haven't
# reached the expiry date sent in the Expires header.
add_header Last-Modified "";
add_header ETag "";
break;
}

# Webfonts (they are in /assets)
location ~* \.(ttf|ttc|otf|eot|woff)$ {
add_header Access-Control-Allow-Methods GET,OPTIONS;
add_header Access-Control-Allow-Headers *;
add_header Access-Control-Allow-Origin *;
}

}


Now the add_header stuff for webfonts is never set, and I do not understand why break has a part in this. When I remove break; it works,
when i put the font location stuff before location ~^/assets/ it also works.

Hope someone can shine some light on this.

Kind Regards,

Frodo Larik
SubjectAuthorPosted

understanding break and add_header combo

flarikMay 02, 2013 11:53AM

Re: understanding break and add_header combo

Francis DalyMay 02, 2013 04:32PM

Re: understanding break and add_header combo

flarikMay 03, 2013 04:00AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 97
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 184 on July 08, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready