Welcome! Log In Create A New Profile

Advanced

Re: [Patch] type{} directive

Grzegorz Nosek
August 18, 2010 10:56AM
On Wed, Aug 18, 2010 at 04:19:08PM +0200, Grzegorz Nosek wrote:
> Hi all,
>
> After a recent discussion I decided to whip up a patch implementing the
> type {} directive to route requests according to MIME types of requested
> files.
>
> The main advantage is a clearer config file, as instead of:
>
> | location ~ \.(gif|png|jpe?g|tif|ico) {
> | expires max;
> | access_log off;
> | }
>
> you can now say:
>
> | type image/* {
> | expires max;
> | access_log off;
> | }

I forgot to say that the type{} directive works inside location{} blocks
too:

| location /dev/ {
| root /www/dev;
|
| type text/* {
| expires epoch;
| }
| }
|
| location /prod/ {
| root /www/prod;
|
| type text/* {
| expires max;
| }
| }

Although if you put a text{} block inside a location{}, this location no
longer interprets e.g. server{}-level types. We'll see if this is a
problem by popular demand :)

Best regards,
Grzegorz Nosek

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

[Patch] type{} directive

Grzegorz Nosek August 18, 2010 10:26AM

Re: [Patch] type{} directive

Grzegorz Nosek August 18, 2010 10:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 331
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready