2018年03月12日のつぶやき

0
    20:00
    varnishでのaclの活用 https://t.co/9PihnU0N87 #jugem_blog
    • 2018.03.13 Tuesday
    • -
    • 03:30
    • -
    • -
    • -
    • -
    • by orz

    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
          123
      45678910
      11121314151617
      18192021222324
      25262728293031
      << March 2018 >>

      selected entries

      categories

      archives

      recent comment

      recent trackback

      recommend

      links

      profile

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

      search this site.

      others

      mobile

      qrcode

      powered

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