Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 719865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:41:35+00:00 2026-05-14T05:41:35+00:00

The HTTP/1.1 RFC stipulates The HEAD method is identical to GET except that the

  • 0

The HTTP/1.1 RFC stipulates “The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response.” I know Apache honors the RFC but modules don’t have to. My question is, does mod_php5 honor this?

The reason I ask is because I just came across an article saying that PHP developers should check this themselves with:

    if (stripos($_SERVER['REQUEST_METHOD'], 'HEAD') !== FALSE) {
        exit();
    }

I googled a second and not much turned up, other than some people saying they try to strange things like mod_rewrite/redirect after getting HEAD requests and some old bug ticket from like 2002 claiming that mod_php still executed the rest of the script by default. So I just ran a quick test by using PECL::HTTP to run

    http_head('http://mysite.com/test-head-request.php');

while having:

    <?php error_log('REST OF SCRIPT STILL RAN'); ?>

in test-head-request.php to see if the rest of the script still executed, and it didn’t.

I figure that should be enough to settle it, but want to get more feedback and maybe help clear up confusion for anyone else who has wondered about this. So if anyone knows off the top of their head (no pun intended) – or have any conventions they use for receiving HEAD requests, that’d be great. Otherwise, I’ll grep the C source later and respond in a comment with my findings. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:41:35+00:00Added an answer on May 14, 2026 at 5:41 am

    The HEAD method is identical to GET
    except that the server MUST NOT return
    a message-body in the response.

    That is why the check should not be performed. Clients should have confidence that HEAD requests process just the same as if a GET was issued (database connection, processing, etc…).

    Addendum:

    When performing

    HEAD /test.php?a=3 HTTP/1.1
    Host: somesite.com
    

    PHP will still fill $_GET (and $_REQUEST) with the variables placed in the query string even though it was not a GET request. This allows compliance with the HEAD definition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since I discovered that HTTP headers are case-insensive according to the RFC, i was
The RFC seems to suggest that the client should permanently cache the response: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
My understanding from reading the specification ( http://www.ietf.org/rfc/rfc2445.txt ) is that the : character
Those fine RFCs mandate from every RFC-client that they beware of not using more
RFC 3986 specifies a generic format for URIs but states that it does not
According to https://www.rfc-editor.org/rfc/rfc3986 and http://en.wikipedia.org/wiki/Uniform_resource_identifier , a URI may or may not contain a
I would like to implement and HTTP proxy server to get a deeper understanding
I am running a TURN server (http://tools.ietf.org/html/rfc5766) on a server that is behind a
Is it to be considered good practice to reuse RFC HTTP Status codes like
The HTTP 1.1 RFC restricts a Client from using more than Two TCP connections

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.