Rewriting for revisioned URLs

Edho P Arief edhoprima at gmail.com
Thu May 21 20:14:08 MSD 2009


On Thu, May 21, 2009 at 11:09 PM, Edho P Arief <edhoprima at gmail.com> wrote:
> On Thu, May 21, 2009 at 10:50 PM, Brian Kirkbride
> <brian.kirkbride at deeperbydesign.com> wrote:
>> Hi all,
>>
>> I'm trying to switch us from LigHTTPD to NginX and have run into some
>> issues.  Any help is much appreciated.
>>
>> We use revisioned URLs to allow for far-future caching of resources (e.g.
>> http://example.com/r1234567890/site.css) and are having trouble getting this
>> to work.
>>
>> Basically we need to strip /r1234567890 from the front of the URI and set
>> expires to max, then check for a file and fallback to FastCGI.
>>
>> I've tried something like:
>>
>>
>> location ~ ^/r[0-9]+ {
>>    if ( $uri ~ ^/r([0-9]+)(/.*)$ ) {
>>        set $rev $1;
> c>        set $realuri $2;
>>    }
>>    expires max;
>>    try_files $root/$realuri @catalyst;
>
> try_files $realuri @catalyst;
>
> ?
>

also iirc you can regex the location

location ~ ^/r([0-9]+)(/.*)$ {
set $rev $1;
set $realuri $2;
expires max;
try_files $realuri @catalyst;
}

(or something like that)

>> }
>>
>>
>> with no luck.  Any ideas?
>>
>> Thanks in advance!
>>
>>
>
>
>
> --
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
>



-- 
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org





More information about the nginx mailing list