how to set any browser to no keep alive in apache httpd.conf

8,982

If you want to disable HTTP keep-alive for all browsers just set KeepAlive to off globally.

No sense wasting resources on a BrowserMatch if you don't have to, but if you really want to use BrowserMatch just compose a regular expression that matches anything. ".*" is a good one.

Share:
8,982

Related videos on Youtube

pablosd
Author by

pablosd

Updated on September 18, 2022

Comments

  • pablosd
    pablosd over 1 year

    I have the following setting for IE in my httpd.conf:

    BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
    

    I want to apply this to all requests that hit my server.

    My httpd.conf section that deals with keep alive looks like this:

    #
    # Timeout: The number of seconds before receives and sends time out.
    #
    Timeout 5
    
    #
    # KeepAlive: Whether or not to allow persistent connections (more than
    # one request per connection). Set to "Off" to deactivate.
    #
    KeepAlive Off
    
    #
    # MaxKeepAliveRequests: The maximum number of requests to allow
    # during a persistent connection. Set to 0 to allow an unlimited amount.
    # We recommend you leave this number high, for maximum performance.
    #
    MaxKeepAliveRequests 1
    
    #
    # KeepAliveTimeout: Number of seconds to wait for the next request from the
    # same client on the same connection.
    #
    KeepAliveTimeout 1
    

    How do I do this?

    • adric
      adric over 10 years
      You should be able to do that in the server global or VirtualHost configuration, no?
    • voretaq7
      voretaq7 over 10 years
      that definitely should disable keepalives... It's not being turned on again somewhere else?
  • pablosd
    pablosd over 10 years
    KeepAlive was already set to off. Does the client need to do something to stop receiving a connection state of keep-alive after a http get is invoked?
  • voretaq7
    voretaq7 over 10 years
    If KeepAlive is Off and not overridden anywhere else then keep-alives should simply not work. I suspect there's more to this that you're not telling us -- what specifically are you trying to accomplish?
  • pablosd
    pablosd over 10 years
    I have a client trying to do a get against a service I have. It just returns a few characters. I have posted all the parameters concerning the keep alive in the question above.
  • voretaq7
    voretaq7 over 10 years
    hmm... I'm not sure Keepalive is your problem, but you certainly appear to have it turned off. You can use my notes above to set HTTP/1.0 for all browsers and see if that helps. If not there may be something else going on...
  • pablosd
    pablosd over 10 years
    I set MaxKeepAliveRequests to 0 and KeepAlive now stays off.