If this blog helped you in any way (professionally), please donate a dollar here

Thursday, July 18, 2013

Timeout while testing with centos httpd (solved)

Hello all,

A tech post after a long time! So, here I was in my desk trying to understand how HTTP headers work. So I did a telnet to my CentOS VM's httpd (apache web server) and just typing

GET / HTTP/1.1

and just when I was in the next line, the connection got terminated. Annoying! Just then my mentor, told me that there were apache flags for that stuff. It looked like this
RequestReadTimeout header=50-80,minrate=1
RequestReadTimeout body=50,minrate=1

So I added that stuff to the "httpd.conf" file and it was supposed to work. Boom! It gives me an error saying the directive was not recognized. 
Now, I tried out the same on a Debian box and it worked like a charm. I could change the header timeout to what I wished and Debian obeyed my command! However, CentOS was a tough customer. So this is what I had to do:

  1. Download the module from here.
  2. Download the development files to compile the mod
    • yum install httpd-devel gcc
  3. Run the build as root:
    • apxs -cia mod_reqtimeout.c
  4. The final step is to setup the module in the folder : /etc/httpd/conf.d/
    • Create a file "reqtimeout.conf"
    • Add the content:
      <IfModule reqtimeout_module>
          RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
      </IfModule >
    • Add custom values if you need.

And you are done. Restart httpd and you resume your debugging session!

No comments:

Post a Comment