Welcome! Log In Create A New Profile

Advanced

Compare $http_referer and $host

Posted by NenadS 
Compare $http_referer and $host
April 16, 2014 11:27AM
Hi,

Is it possible to compare $http_referer and $host variables with regexp like this?

if ( $http_referer ~ $host ) {
set $match 1;
}

I want to check if http_referer is equal to host in order to send pages from cache. I have one default_server config because I'm using wildcard as domain name so any domain name pointed to IP will show default page.

I've tried with ~* ^http://$host but it does not work probably because of $ sign in host variable.

Any advice is welcome.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 64
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready