<div dir="ltr">
Hi, <div><br></div><div>You would be better to accomplish this with map. Would this work?</div><div><br></div><div><div>map $args $redirect {</div><div>    ~emailaddress=.+%40[a-zA-Z0-9\.\-]          '';</div><div>    default                                     "1";</div><div>}</div><div><br></div><div>server {</div><div>    ...</div><div>    location / {</div><div>        ...</div><div>    }</div><div><br></div><div>    location /foo {</div><div>        if ($redirect) { return 301 /; }</div><div>        ...<br></div><div>    }</div><div><br></div><div>}</div></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 4, 2017 at 1:52 PM, 173279834462 <span dir="ltr"><<a href="mailto:nginx-forum@forum.nginx.org" target="_blank">nginx-forum@forum.nginx.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
Our local policy demands the rejection of any query; we do this as follows:<br>
if ($is_args) { return 301 /; }<br>
<br>
The introduction of Thunderbird autoconfiguration demands an exception to<br>
the above policy, because of<br>
"GET<br>
/.well-known/autoconfig/mail/c<wbr>onfig-v1.1.xml?emailaddre=unam<wbr>e%<a href="http://40example.com" rel="noreferrer" target="_blank">40example.com</a>".<br>
<br>
The resulting rule would be<br>
<br>
if (($is_args) && ($args !~ emailaddress=.+%40[a-zA-Z0-9\.<wbr>\-]+)) { return<br>
301 /; }<br>
<br>
The rule does not work, because nginx does not parse the AND condition.<br>
<br>
Of course, you cannot just remove $is_args, because $args is usually empty.<br>
<br>
<br>
The alternative would be if ($args ~ emailaddress=.+%40[a-zA-Z0-9\.<wbr>\-]+)) {<br>
allow all; } else { return 301 /; },<br>
but nginx does not parse if-then-else statements.<br>
<br>
Are we stuck in the cage?<br>
<br>
Posted at Nginx Forum: <a href="https://forum.nginx.org/read.php?2,272758,272758#msg-272758" rel="noreferrer" target="_blank">https://forum.nginx.org/read.p<wbr>hp?2,272758,272758#msg-272758</a><br>
<br>
______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailm<wbr>an/listinfo/nginx</a><br>
</blockquote></div><div><br></div>
</div></div></div>