<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 29.07.2018 06:11, Gordon Hsiao wrote:
    <blockquote
cite="mid:CAK0iFYzxwt2gQ-+wM9bsrnJF3uLAhhRtpE4pU0Wb4O1qgp3yOA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
      <div>is there a way to block any attempt to visit http/https by
        _any_ IP directly, i.e. 
        <div><br>
        </div>
        <div><a moz-do-not-send="true" href="http://my-IP">http://my-IP</a>
          or <a moz-do-not-send="true" href="https://my-IP">https://my-IP</a>
          (yes this will give a warning for SSL most likely). here my-IP
          could be any IPv4 address, for example.<br>
        </div>
        <div><br>
        </div>
        <div>Basically I want to have Squid to enforce all 80/443 access
          should be done via a FQDN instead of an IP, is this possible?
          or should this be handled in a redirector instead?</div>
        <br>
      </div>
    </blockquote>
    Hi,<br>
    <br>
    I use this<br>
    <br>
    /etc/squid/blockdomains-iphost-acl.squid  contains this<br>
    <br>
    ^[12]?[0-9]{1,2}\.[12]?[0-9]{1,2}\.[12]?[0-9]{1,2}\.[12]?[0-9]{1,2}$<br>
    ^\[([0-9a-f]{0,4})(:|:[0-9a-f]{0,4}){1,7}\]$<br>
    <br>
    /etc/squid/squid.conf contains this<br>
    <br>
    acl allow_domains_iphost dstdom_regex
    "/etc/squid/allowdomains-iphost-acl.squid"<br>
    acl block_domains_iphost dstdom_regex
    "/etc/squid/blockdomains-iphost-acl.squid"<br>
    ...<br>
    deny_info ERR_DOMAIN_IPHOST_BLOCKED block_domains_iphost<br>
    ...<br>
    http_access allow allow_domains_iphost<br>
    http_access deny block_domains_iphost<br>
    <br>
    <br>
    <br>
  </body>
</html>