<span style="color: rgb(51, 51, 51);">Do this to return No Content...</span><br style="color: rgb(51, 51, 51);"><br style="color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);">location = /favicon.ico {</span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);">
<span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> return 204;</span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);">}</span><br style="color: rgb(51, 51, 51);">
<br style="color: rgb(51, 51, 51);"><span style="color: rgb(51, 51, 51);">Or this to do basically the same, which spits out an empty gif from memory...</span><br style="color: rgb(51, 51, 51);"><br style="color: rgb(51, 51, 51);">
<span style="font-family: courier new,monospace; color: rgb(51, 51, 51);">location = /favicon.ico {</span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> empty_gif;</span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);">
<span style="font-family: courier new,monospace; color: rgb(51, 51, 51);">}</span><br><br><br>On Tue, Jul 1, 2008 at 8:27 AM, Marcos Neves <<a href="mailto:marcos.neves@gmail.com">marcos.neves@gmail.com</a>> wrote:<br>
><br>> My current solution works:<br>><br>> location = /favicon.ico {<br>> if (!-f $request_filename) {<br>> rewrite ^.*$ /favicon.ico.default;<br>> }<br>> }<br>> location = /favicon.ico.default {<br>
> internal;<br>> alias html/favicon.ico;<br>> break;<br>> }<br>><br>> but would be nice if possible to do this:<br>><br>><br>> location = /favicon.ico {<br>> if (!-f $request_filename) {<br>
> alias html/favicon.ico;<br>> break;<br>> }<br>><br>> But alias canĀ“t be used inside an if. Why that?<br>><br>> On Tue, Jul 1, 2008 at 10:15 AM, Igor Sysoev <<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>> wrote:<br>
> > On Tue, Jul 01, 2008 at 05:09:33PM +0400, Maxim Dounin wrote:<br>> ><br>> >> Hello!<br>> >><br>> >> On Tue, Jul 01, 2008 at 08:03:23AM -0300, Marcos Neves wrote:<br>> >><br>
> >> >your solution is DRY, but I?m not sure if it?s right to send a 404 code,<br>> >> >is it?<br>> >><br>> >> Feel free to use<br>> >><br>> >> error_page 404 = html/favicon.ico;<br>
> >><br>> >> instead (note the '=').<br>> >><br>> >> See <a href="http://wiki.codemongers.com/NginxHttpCoreModule#error_page">http://wiki.codemongers.com/NginxHttpCoreModule#error_page</a> for<br>
> >> details.<br>> ><br>> > No, html/favicon.ico will not work. It should be redirected to something like<br>> > /html/favicon.ico, and then some location /html/... should be described.<br>> ><br>
> >> Maxim Dounin<br>> >><br>> >> ><br>> >> >On Mon, Jun 30, 2008 at 5:24 PM, Cliff Wells <<a href="mailto:cliff@develix.com">cliff@develix.com</a>> wrote:<br>> >> >>On Mon, 2008-06-30 at 17:16 -0300, Marcos Neves wrote:<br>
> >> >>>I?m doing this to show a default favicon.ico, when the site doesn?t have<br>> >> >>>one:<br>> >> >>><br>> >> >>> location = /favicon.ico {<br>
> >> >>> if (!-f $request_filename) {<br>> >> >>> rewrite ^.*$ /favicon.ico.default;<br>> >> >>> }<br>> >> >>> }<br>
> >> >>> location = /favicon.ico.default {<br>> >> >>> internal;<br>> >> >>> alias html/favicon.ico;<br>> >> >>> break;<br>
> >> >>> }<br>> >> >>><br>> >> >>>But I think it?s to ugly and far from DRY.<br>> >> >>>Is there any way to short this code?<br>> >> >><br>
> >> >>Not sure how "DRY" applies in this context...<br>> >> >><br>> >> >>What you probably want is something like this:<br>> >> >><br>> >> >>location = /favicon.ico {<br>
> >> >> error_page 404 html/favicon.ico;<br>> >> >>}<br>> >> >><br>> >> >>Cliff<br>> >> >><br>> >> >><br>> >> >><br>
> >> >><br>> >> ><br>> >> ><br>> >> ><br>> >> >--<br>> >> >Marcos Neves<br>> >> >+55 44 3263-8132<br>> >> >+55 44 9918-8488<br>
> >> ><br>> ><br>> > --<br>> > Igor Sysoev<br>> > <a href="http://sysoev.ru/en/">http://sysoev.ru/en/</a><br>> ><br>> ><br>><br>><br>><br>> --<br>> Marcos Neves<br>
> +55 44 3263-8132<br>> +55 44 9918-8488<br>><br><br>