is it possible to create "if" rule with rewrite action inside custom 404
location?
the task is fallback to jpg if upstream returns 404 for .webp request.
i've double-checked regexp's - they seems to be write....



location ~* \.(jpg|mp4|svg|jpeg|gif|png|css|bmp|js|swf|webp|jp2|ico)$ {

etag on;

        proxy_cache site;

        proxy_cache_valid  404 302 1m;

        expires max;

        proxy_cache_valid 2h;

        proxy_pass http://cdn;

        proxy_intercept_errors on;

        proxy_connect_timeout 5s;

        proxy_next_upstream error timeout http_404 http_403 http_500
http_502 http_503 http_504;

        error_page 404 /webp.html;

}


location = /webp.html {

        if ($request_filename ~* ^.+.webp$) {

                rewrite ^/(.*)\.webp$ /$1.jpg redirect;

        }

        root /var/www/;

}
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to