Too Many Redirects - CDN Rewrite Rule

Steve Holdoway steve at greengecko.co.nz
Thu Mar 21 03:00:25 UTC 2013


On Wed, 2013-03-20 at 22:47 -0400, toddlahman wrote:
> I have tried both ways to redirect my static files to a CDN (content
> delivery network), but both ways result in the message "too many redirects."
> Can anyone tell me what I am doing wrong here?
> 
> location ~* ^.+.(jpe?g|gif|css|png|js|ico)$ {
>        rewrite ^ http://cdn.mydomain.com$request_uri? permanent;
>        access_log off;
> }
> 
> 
> location ~* \.(jpg|jpeg|gif|png|flv|mp3|mpg|mpeg|js|css|ico|woff)$ {
>        return 301 http://cdn.mydomain.com$request_uri;
>        access_log off;
> }
> 
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,237609,237609#msg-237609
> 
That should work ok. Are you sure your cdn isn't using the same ruleset?

Steve
-- 
Steve Holdoway BSc(Hons) MIITP 
http://www.greengecko.co.nz
Skype: sholdowa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6189 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130321/2e777bee/attachment.bin>


More information about the nginx mailing list