New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passenger 5 with Apache: Keep Alive does not work #1516

Closed
ledermann opened this Issue May 20, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@ledermann

ledermann commented May 20, 2015

After upgrading an Apache based server to Passenger 5 (from Passenger 4) it seems there is an issue with Keep Alive: In the response header of all HTML requests (coming from a Rails app) I get Connection: close instead of Connection: Keep-Alive.

Example response header:

$ curl -I https://my-example-app.com

HTTP/1.1 200 OK
Date: Wed, 20 May 2015 12:21:14 GMT
Server: Apache
cache-control: max-age=0, private, must-revalidate
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
x-request-id: bc7ebbcc-ccc1-4e5d-9d8b-4e63019b9b26
Connection: close
X-Powered-By: Phusion Passenger 5.0.8
Set-Cookie: 0a317539bf13980f0a8fbe3449d777c8...truncated....FCelRvbWc9PQ%3D%3D--2f8c761c9afee4cd1994deb83532e3d26440bef5; path=/; HttpOnly
etag: W/"44dea0d2c94d34fd86fb4a71ebd2c0a8"
Status: 200 OK
Cache-Control: max-age=31536000
Expires: Thu, 19 May 2016 12:21:14 GMT
Vary: User-Agent
Strict-Transport-Security: max-age=0
Content-Type: text/html; charset=utf-8

The connection gets closed for HTML requests only. For asset files (CSS, JS, SVG etc.) it works fine, connection is kept alive. Example:

$ curl -I https://static1.my-example-app.com/assets/application-3e1880ce1cdcea5e8c73918e24e3971fa68c69e2f35d1e0442b8998d34aca8bc.css

HTTP/1.1 200 OK
Date: Wed, 20 May 2015 12:01:21 GMT
Server: Apache
Last-Modified: Wed, 20 May 2015 08:53:02 GMT
ETag: "408c6-5167f8df73780-gzip"
Accept-Ranges: bytes
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
Cache-Control: max-age=31536000, public
Expires: Thu, 19 May 2016 12:01:21 GMT
Strict-Transport-Security: max-age=0
Content-Length: 42846
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/css

Server components:

  • Ubuntu 14.04.2 LTS
  • Apache 2.4.7
  • Passenger 5.0.8
  • Ruby 2.1.6
  • Rails 4.2.1

Maybe the issue is caused by a misconfigured server or the Rails app. Are there any hints to debug the issue?

@OnixGH

This comment has been minimized.

Contributor

OnixGH commented May 20, 2015

@ledermann thanks for reporting! It looks like Apache is not explicitly setting Connection: keep-alive (it isn't mandatory) and you are seeing the Connection:close used for Apache/Passenger traffic leaking through. We'll fix this for the next release.

@OnixGH OnixGH added this to the 5.0.9 milestone May 20, 2015

OnixGH pushed a commit that referenced this issue May 22, 2015

Daniel Knoppel (Phusion)
Fix HTTP 1.1 Keep-Alive not working for Apache.
Prevent the internal `Connection: close` header from leaking to the
client and breaking Keep-Alive. Closes GH-1516.

OnixGH pushed a commit that referenced this issue May 26, 2015

Daniel Knoppel (Phusion)
Fix HTTP 1.1 Keep-Alive not working for Apache.
Prevent the internal `Connection: close` header from leaking to the
client and breaking Keep-Alive. Closes GH-1516.

@OnixGH OnixGH closed this May 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment