Welcome! Log In Create A New Profile

Advanced

Compare $http_referer and $host

Posted by NenadS 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
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.

Online Users

Guests: 95
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready