Blocking HEAD requests in apache

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ZoiNk
    Confirmed User
    • Feb 2002
    • 2370

    #1

    Blocking HEAD requests in apache

    Does anyone know how to block head requests and still let legit connections through. I am sure there is a way in the htaccess file, or if not, using the apache config. Anyone know? Thanks,
    ZoiNk
    "People can have the Model T in any color - so long as it's black." - Henry Ford
  • RK
    Confirmed User
    • Aug 2001
    • 868

    #2
    Why would you block HEAD requests?

    Are you being attacked?
    Does anyone look down here?

    Comment

    • fuzebox
      making it rain
      • Oct 2003
      • 22363

      #3
      What are you trying to accomplish?

      Comment

      • freeadultcontent
        Confirmed User
        • Oct 2002
        • 9976

        #4
        Never turn down head.

        Exclusive Ethnic & Microniche Sites

        Comment

        • ZoiNk
          Confirmed User
          • Feb 2002
          • 2370

          #5
          A friend of mine was asking, so I thought I would try and find the answer for him.

          Attackers try bruteforcing htaccess password protection, and it shows up as a HEAD request, not a get request. for the password protected area, i want to allow only GET requests. there is multiple attempts by dozens of ip addresses at the same time, so it is hard/not practical to block them or redirect stuff. the attacks come and go, but it would be easier on server resources if would just deny HEAD requests for that directory and not bother to authenicate.

          ZoiNk
          "People can have the Model T in any color - so long as it's black." - Henry Ford

          Comment

          • ZoiNk
            Confirmed User
            • Feb 2002
            • 2370

            #6
            Originally posted by freeadultcontent
            Never turn down head.
            .... Except when it comes from a guy offering....

            ZoiNk
            "People can have the Model T in any color - so long as it's black." - Henry Ford

            Comment

            • RK
              Confirmed User
              • Aug 2001
              • 868

              #7
              So I was right.
              Use something like this, this is not PHP but the only way the board will let me post it:

              PHP Code:
              <Limit GET POST>
                ...
                access restriction directives such as require or deny
                ...
              </Limit> 
              
              Last edited by RK; 02-01-2004, 09:53 PM.
              Does anyone look down here?

              Comment

              • nuclei
                old school fart
                • May 2001
                • 1015

                #8
                drop this in a .htaccess in the directory you want to deny HEAD requests from. Then test to make sure it doesnt deny get/post. It shouldn't tho.


                &lt;Limit HEAD&gt;
                order deny,allow
                deny from all
                &lt;/Limit&gt;
                The next generation of SEO

                Comment

                • CGI
                  Confirmed User
                  • Apr 2002
                  • 139

                  #9
                  &lt;LimitExcept GET POST&gt;
                  order deny,allow
                  deny from all
                  &lt;/LimitExcept&gt;
                  Last edited by CGI; 02-01-2004, 10:28 PM.
                  Komply - The 2257 record keeping & content management application (sneak preview)
                  Manic Cash - Tight Niches, Solid Payouts...
                  ICQ 346121285

                  Comment

                  Working...