On Sun, Aug 15, 2010 at 12:39 AM, Igor Sysoev <span dir="ltr">&lt;<a href="mailto:igor@sysoev.ru">igor@sysoev.ru</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div><div></div><div class="h5">On Sat, Aug 14, 2010 at 12:14:46PM -0700, kevin wrote:<br>
<br>
&gt; On Sat, Aug 14, 2010 at 12:01 PM, Edho P Arief &lt;<a href="mailto:edhoprima@gmail.com">edhoprima@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; On Sun, Aug 15, 2010 at 1:49 AM, kevin &lt;<a href="mailto:kevincastiglione@gmail.com">kevincastiglione@gmail.com</a>&gt; wrote:<br>
&gt; &gt; &gt; On Sat, Aug 14, 2010 at 11:42 AM, kevin &lt;<a href="mailto:kevincastiglione@gmail.com">kevincastiglione@gmail.com</a>&gt;<br>
&gt; &gt; wrote:<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; On Sat, Aug 14, 2010 at 10:07 AM, Igor Sysoev &lt;<a href="mailto:igor@sysoev.ru">igor@sysoev.ru</a>&gt; wrote:<br>
&gt; &gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt; On Fri, Aug 13, 2010 at 07:43:58PM -0700, kevin wrote:<br>
&gt; &gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt; &gt; requests like these are hitting my server, and i want to catch these<br>
&gt; &gt; &gt;&gt;&gt; &gt; requests, and return &#39;not found&#39; from nginx. i dont want it to hit my<br>
&gt; &gt; &gt;&gt;&gt; &gt; fastcgi backend.<br>
&gt; &gt; &gt;&gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt;&gt; &gt; [13/Aug/2010:19:39:26 -0700]  &quot;POST /%5C%22http:%5C/%5C/<br>
&gt; &gt; &gt;&gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt;&gt; &gt; <a href="http://photos-b.ak.fbcdn.net" target="_blank">photos-b.ak.fbcdn.net</a><br>
&gt; &gt; %5C/photos-ak-snc1%5C/v43%5C/64%5C/68931197560%5C/app_2_68931197560_3211.gif%5C%22<br>
&gt; &gt; &gt;&gt;&gt; &gt; HTTP/1.1&quot; 404 103 &quot;-&quot; &quot;Mozilla/5.0 (Macintosh; U; Intel Mac OS X<br>
&gt; &gt; 10.5;<br>
&gt; &gt; &gt;&gt;&gt; &gt; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8&quot; 0.087 US<br>
&gt; &gt; &gt;&gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt;&gt; &gt; how do i match requests with url starting like this:<br>
&gt; &gt; &gt;&gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt;&gt; &gt; /%5C%22http:%5C/%5C/<br>
&gt; &gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt; Try<br>
&gt; &gt; &gt;&gt;&gt;   location /\&quot;http:\/\/ {<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I tried this, but did not help<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;         location /\&quot;http:\/\/ {<br>
&gt; &gt; &gt;             access_log logs/junk.log wtop;<br>
&gt; &gt; &gt;             rewrite ^/(.*) <a href="http://www.XXX.com" target="_blank">www.XXX.com</a> permanent;<br>
&gt; &gt; &gt;         }<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; it does not catch it. it is still hitting my fastcgi backend<br>
&gt; &gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; put it in the topmost of your server block.<br>
&gt; &gt;<br>
&gt; yes i have it in the top most position in server block. all other location<br>
&gt; sections are below this and it still does not catch it. it is going to the<br>
&gt; location that matches the last block<br>
&gt; location / {<br>
<br>
</div></div>Sorry, the slashes should be escaped, this is working configuration:<br>
<br>
        location ^~ /\\&quot;http:\\/\\/ {<br>
            return 404;<br>
        }<br>
<br>
&quot;^~&quot; is to disable regex locations.<br></blockquote><div>thanks a lot! this catches it and returns 404!<br><br>is it possible to customize the 404 message for this location?<br>thanks!<br></div></div>