varnishでのaclの活用

0

    今まで、こんな感じで書いていたけど、aclを使えばだいぶスッキリする

    if ( req.http.X-Real-IP ~ (111.111.111.111|222.222.222.222) ) {
        return (synth(403, Forbidden - administrator only));
    }
    

     

    ACLの設定

    acl bad_ips {
      111.111.111.111;
      222.222.222.222;
    }
    sub vcl_recv {
    
      if ( std.ip(req.http.X-Real-IP, 0.0.0.0) ~ bad_ips) {
    
       return (synth(403, Forbidden));
    
      }
    
    }
    
    

    なかなかいいね


    1

    calendar

    S M T W T F S
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31      
    << March 2024 >>

    selected entries

    categories

    archives

    recent comment

    recent trackback

    recommend

    links

    profile

    書いた記事数:219 最後に更新した日:2022/09/09

    search this site.

    others

    mobile

    qrcode

    powered

    無料ブログ作成サービス JUGEM