nginx location 配置

location ~* /admin/login {
#set $my_ip '';
#if ( $http_x_forwarded_for !=client ip){set $my_ip 1;}
#if ( $http_x_forwarded_for != client ip ){ set $my_ip 1;}
#if ( $my_ip = 1) {
# return 302;
#}
#if ($http_x_forwarded_for != "ip1" ) {  
#return 302;
#proxy_pass http://127.0.0.1:8080;
# }
if ( $http_x_forwarded_for !~ "ip1|ip2" ) {  #不在ip1和ip2 允许列表中的 直接return 404  如果没有SLB 直接是 $remote_addr
return 404;
}

proxy_pass http://127.0.0.1:8080; #允许的直接通过代理到后端

}

相关文章:

  • 2021-10-10
  • 2021-12-22
  • 2021-09-01
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-19
  • 2021-12-27
  • 2022-01-18
  • 2021-06-25
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
相关资源
相似解决方案