Welcome! Log In Create A New Profile

Advanced

Permit access on the base of HTTP value header or IP address

Posted by oblack 
Permit access on the base of HTTP value header or IP address
August 30, 2019 03:24AM
Hi,

i would like to implement restriction on the base of specific value in http header (currently implemented and it works) or specific IP address. So if the traffic has specific http header value OR if the traffic is coming from specific IP address the traffic should be permitted the other traffic should be denied. How to add OR rule for IP addresses?

Current config is something like following:

upstream www_domain {
server origin:443 resolve;
zone upstream_backend 256k;
}

server {
listen 80;
server_name www.domain.com;
access_log /var/log/nginx/access.log main;
proxy_pass_header Server;

location / {
access_by_lua 'validate_nginx(3, "xyz", 30)';
proxy_pass https://www_domain;
proxy_set_header Host $server_name;
real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
}
}

Thanks,

Oblack
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 82
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