Welcome! Log In Create A New Profile

Advanced

Re: valid_referers dynamic hostname

May 24, 2013 07:10AM
Thanks alot! I made a logical error when writing your expression by thinking that it will negate the comparison.

Also, I appreciate you have explained that http/https matching as I was confused.


My best regards,
Vlad



Maxim Dounin Wrote:
-------------------------------------------------------
> Hello!
>
> On Mon, May 20, 2013 at 02:14:02PM -0400, vlad031@binkmail.com 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";
> > }
>
> Just a side note: this statement isn't needed. Both http and
> https schemes are allowed by a "https?" in the regular expression
> I provided, "?" makes preceeding character option.
>
> >
> > if ($temp ~* "^(.*):https?://\1") {
> > set $test "${test}C";
> > }
> >
> > if ($test = ABC) {
> > return 444 ;
> > }
> >
> > It is always returning 444 ... what am I doing wrong?!
>
> You probably mean to write
>
> if ($test = A) {
> return 444;
> }
>
> instead, as your initial message suggests you want to allow
> requests where Referer matches Host.
>
> --
> Maxim Dounin
> http://nginx.org/en/donation.html
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
SubjectAuthorPosted

valid_referers dynamic hostname

vlad031@binkmail.comMay 18, 2013 01:31PM

Re: valid_referers dynamic hostname

vlad031@binkmail.comMay 20, 2013 07:27AM

Re: valid_referers dynamic hostname

Maxim DouninMay 20, 2013 09:20AM

Re: valid_referers dynamic hostname

vlad031@binkmail.comMay 20, 2013 02:14PM

Re: valid_referers dynamic hostname

B.R.May 20, 2013 02:28PM

Re: valid_referers dynamic hostname

Maxim DouninMay 20, 2013 02:36PM

Re: valid_referers dynamic hostname

vlad031@binkmail.comMay 24, 2013 07:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 95
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready