valid_referers dynamic hostname

B.R. reallfqq-nginx at yahoo.fr
Mon May 20 18:26:24 UTC 2013


I suggest you take a look at the order in which 'if' statements are
evaluated.
Consider reading the 'if' directive
documentation<http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if>
.
---
*B. R.*


On Mon, May 20, 2013 at 2:14 PM, vlad031 at binkmail.com
<nginx-forum at nginx.us>wrote:

> Hello,
>
> Thank you for your example Maxim. This is what I've wrote in my config:
>
> set $temp "$host:$http_referer";
>
> valid_referers none blocked server_names ~\.google\. ~\.yahoo\. ~\.bing\.
> ~\.ask\. ~\.live\. ~\.googleusercontent.com\. ;
>
> if ($invalid_referer){
>     set $test A ;
> }
>
> if ($temp ~* "^(.*):http?://\1") {
>     set $test "${test}B";
> }
>
> if ($temp ~* "^(.*):https?://\1") {
>     set $test "${test}C";
> }
>
> if ($test = ABC) {
>     return 444 ;
> }
>
> It is always returning 444 ... what am I doing wrong?!
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,239318,239352#msg-239352
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130520/db8892b4/attachment.html>


More information about the nginx mailing list