Welcome! Log In Create A New Profile

Advanced

Re: Setting expires header to multiple locations

howard chen
December 14, 2012 09:44AM
Hi Ignor

On Fri, Dec 14, 2012 at 8:37 PM, Igor Sysoev <igor@sysoev.ru> wrote:
>
>
> This valid only if "~* /b" was intended for "~* ^/b".
>
> As to me, I prefer to isolate regex locations (if I have to use them at
> all)
> inside usual locations:
>
> location /c {
> location ~* \.(?:css|js|jpg|jpeg|gif|png)$ {
> expires 1y;
> }
> }
>
>
My issue is in nginx, url can only be matched to only ONE location, unlike
in Apache we have something like * ExpiresByType*, seems duplicate
multiple locations is a must in nginx.

e.g.


location ~* /a {
location ~* ^/.*\.(?:css|js|jpg|jpeg|gif|png)$ {
expires 1y;
}

# more unique config for /a, cannot be combined
}

location ~* /b {
location ~* ^/.*\.(?:css|js|jpg|jpeg|gif|png)$ {
expires 1y;
}

# more unique config for /b, cannot be combined
}

location ~* /c {
location ~* ^/.*\.(?:css|js|jpg|jpeg|gif|png)$ {
expires 1y;
}

# more unique config for /c, cannot be combined
}


Any better way?
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Setting expires header to multiple locations

howard chen December 14, 2012 06:32AM

Re: Setting expires header to multiple locations

Edho Arief December 14, 2012 06:40AM

Re: Setting expires header to multiple locations

Antonio P.P. Almeida December 14, 2012 07:00AM

Re: Setting expires header to multiple locations

Igor Sysoev December 14, 2012 07:38AM

Re: Setting expires header to multiple locations

howard chen December 14, 2012 09:44AM

Re: Setting expires header to multiple locations

howard chen December 14, 2012 09:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 60
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready