logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Remove "Connection and keep-alive" response header
Author
deepakc3



Joined: 17 Aug 2012
Posts: 4
Location: U.S.A

PostPosted: Fri 17 Aug '12 16:39    Post subject: Remove "Connection and keep-alive" response header Reply with quote

How can i remove "Connection and keep-alive" from response headers ?
I am using Apache http server to load balance two tomcat nodes
Apache Server- Apache/2.4.2
mod_jk - 1.2.27
Apache tomcat - Apache Tomcat/7.0.23
JDK - 1.6

I have also enabled SSL in the apache http server using mod_ssl.
The load balancing works fine, but in all the response headers these connection attributes are added
"Connection: keep-alive
keep-alive: timeout=5"

Is there a way to remove these headers? I do not want these headers to be added in the response.
I have also tried mod_header to unset these headers, but no use.
HTTP/1.1 protocol is being used, so eventhough the connection is not present in the header, the connection would should be considered as persistent. Why is apache sending these attributes explicitly in each response. I just want to get rid of these attribute...
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Fri 17 Aug '12 17:41    Post subject: Reply with quote

Search in your apache config files for KeepAlive On change that to KeepAlive Off.
If you can't find that in your config file, just add at the end KeepAlive Off.
Back to top
deepakc3



Joined: 17 Aug 2012
Posts: 4
Location: U.S.A

PostPosted: Fri 17 Aug '12 17:50    Post subject: Reply with quote

Even if i set KeepAlive off, I get the Connection attribute in the response header as
"Connection: close"

I just wanted to remove this attribute completely.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Fri 17 Aug '12 18:05    Post subject: Reply with quote

What is so bad about that header?

removing that header will break the HTTP/1.1 connection
it is a MUST for a connection to the server.

---- edit ----

There is a bug report that by design you can't remove some header from apache by design.

https://issues.apache.org/bugzilla/show_bug.cgi?id=40026
Back to top
deepakc3



Joined: 17 Aug 2012
Posts: 4
Location: U.S.A

PostPosted: Fri 17 Aug '12 19:33    Post subject: Reply with quote

No, removing that header will not break the HTTP/1.1 connection. In HTTP/1.1 it is not required to explicitly say that the connection is keep-alive, because it keep-alive by default.

Other load balancers like NetScaler is not sending these keep-alive header eventhough they are using HTTP/1.1 protocol.

The thing bad about this header is,
iphone sdk API has a wierd issue in reusing the socket connection, which closes the connection when i have the keep-alive (whatever high the timeout is) in the header. It works fine, if this header is not present. I will not be able to fix this issue now, so i wanted to remove the "Connection" and "keep-alive" from header.
Back to top
christoz777



Joined: 07 Mar 2013
Posts: 2

PostPosted: Fri 08 Mar '13 0:46    Post subject: Reply with quote

Did you ever find a solution? I am in the same exact situation.

We have implemented the PRG pattern (http://en.wikipedia.org/wiki/Post/Redirect/Get) using JSF/Seam. The issue is that in the ajax-response for the redirect (the "R" in "PRG") apache is inserting "Connection=Keep-Alive". However, Safari and Firefox are not adding in the "Connection=Keep-Alive" header on the subsequent get request (the "G" in "PRG") and this is causing apache to not return anything for that request.

Any help is greatly appreciated.

Thanks
Back to top
deepakc3



Joined: 17 Aug 2012
Posts: 4
Location: U.S.A

PostPosted: Fri 08 Mar '13 23:57    Post subject: Reply with quote

No i haven't found a way to remove the "Connection=Keep-Alive" from header.
As far as i have analyzed you don't have an option to remove the 'Connection' attribute from header.
Back to top
christoz777



Joined: 07 Mar 2013
Posts: 2

PostPosted: Sat 09 Mar '13 0:04    Post subject: Reply with quote

Thanks for your reply. What did you end up doing to workaround it? Our situations are not the same as your are using iphone sdk and my issues is around jsf/seam/java. Just curious.
Back to top


Reply to topic   Topic: Remove "Connection and keep-alive" response header View previous topic :: View next topic
Post new topic   Forum Index -> Apache