Passenger and Apache: X-died: bad chunck size - apache

I am upgrading an old Rails application to the most recent versions of Ruby, Rails, Authlogic, Passenger etc. The new version works OK with WEBrick, but I cannot get it to work with Apache2.2 and Passenger 3.0.7 (the old one worked nicely). The problem is that the requests return a bad chunk size header and no content:
GET http://www.xxx.xxx:6090/user_sessions/new returns:
Cache-Control: max-age=0, private, must-revalidate
Connection: close
Date: Wed, 03 Aug 2011 20:15:17 GMT
ETag: "3fca75eeb48caf4fe548695a588b916d"
Server: Apache/2.2.16 (Unix) Phusion_Passenger/3.0.7
Content-Type: text/html; charset=utf-8
Client-Aborted: die
Client-Date: Wed, 03 Aug 2011 20:15:17 GMT
Client-Peer: xxx.xxx.14.54:6090
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
Set-Cookie:
_postliste_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRiIlNjQ3MzJmMWE3NDY3ZGQ2YWYwZWEzMjBmMjliYzk5NDZJIhBfY3NyZl90b2tlbgY7AEZJIjFQLy94REd2MGxqMFNlYm1HUWNvOGh5THE4NU5RY2xXODVEWFVLU2EvMUxvPQY7AEY%3D--a1dc7975c23d0139ab92a20a88395ea3c4bc7304; path=/; HttpOnly
Status: 200
X-Died: Bad chunk-size in HTTP response: %lx at /local/share/perl5/vendor_perl/5.8.8/Net/HTTP/Methods.pm line 484.
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.7
X-Runtime: 0.035096
X-UA-Compatible: IE=Edge,chrome=1
I fail to see the way out and would greatly appreciate suggestions to solve the problem.
Regards
Per
Solved:
Installed Apache 2.2.19 from scratch with fresh APU and APR
./configure --prefix=/site/opt/apache-test --with-included-apr
Installed Passenger 3.0.8 and took care to use new APU and APR
Don't know if the APU/APR-stuff was significant, but the reinstallation solved the problem of bad
chunking of the http-messages.
Per

Related

Yum can't get repo update but curl can get url

In a Oracle Linux docker image, I can get this url with curl :
# curl -I https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/repodata/repomd.xml
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Type: application/xml
ETag: "28f9cc1bb8a41a0e928e2e36ff54b46f:1675908836.186431"
Last-Modified: Thu, 09 Feb 2023 02:12:54 GMT
Server: AkamaiNetStorage
Content-Length: 3697
Date: Mon, 13 Feb 2023 15:51:36 GMT
Connection: keep-alive
X-Frame-Options: SAMEORIGIN
But, I can't pull update from yum
# yum update
Loaded plugins: ovl, ulninfo
https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 503 - Service Unavailable
Any idea to debug the http GET request of yum ?
Thank you for your help

how to debug browser caching issue?

I have configured apache http with some cache settings. However, it does not seem to work properly and the browser seems to keep fetching the file as if it's not cached.
I tried to debug it by fetching the header.
$ curl -skI https://whatever-url-it-is/some-script.js
HTTP/1.1 200 OK
Date: Sun, 15 Sep 2019 05:35:08 GMT
Server: Apache/2.4.39 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
Last-Modified: Sun, 02 Jul 2017 10:52:25 GMT
ETag: "152ba-5535372162c40"
Accept-Ranges: bytes
Content-Length: 86714
Cache-Control: max-age=2592000, public
Expires: Tue, 17 Sep 2019 05:35:08 GMT
Vary: Accept-Encoding,User-Agent
Content-Type: text/javascript
The Cache-Control header seems to be correct. The Expires header looks a little odd but according to this page (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires) the Expire will be ignored given that Cache-Control is there.
What else can I do to debug this issue? Any idea is very well welcome. Thanks
Never mind. I didn't realized that "Disable Cache" was turned on in Chrome. User error :-)

HHVM + Apache + Varnish + Drupal 404

This seems like quite an odd thing to be happening, but I'm getting 404 responses but the pages are still displaying as expected.
I do have a slightly odd setup on this server, as we're running HHVM for PHP pages and using Varnish as we need to direct some of the pages to our old server.
We're running Drupal on this server and it seems to work fine except the 404 response seems to be stopping the login form from working.
I was going to add some images to show what's going on, but unfortunately don't have enough reputation....
here's the what we get from a GET -Sed request
pete#pete-work ~ $ GET -Sed http://beta.newint.org/user
GET http://beta.newint.org/user
404 Not Found
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
Connection: close
Date: Wed, 27 May 2015 15:14:23 GMT
Via: 1.1 varnish
Age: 0
Server: Apache
Vary: Accept-Encoding
Content-Language: en
Content-Type: text/html; charset=utf-8
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Client-Date: Wed, 27 May 2015 15:14:23 GMT
Client-Peer: 178.79.141.247:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
ImageToolbar: false
Link: <http://beta.newint.org/user>; rel="canonical",<http://beta.newint.org/user>; rel="shortlink"
Title: User account | Site-Install
X-Generator: Drupal 7 (http://drupal.org)
X-Meta-Charset: utf-8
X-Meta-Generator: Drupal 7 (http://drupal.org)
X-Meta-Viewport: width=device-width, maximum-scale = 1.0
X-Powered-By: HHVM/3.7.0
X-Varnish: 1786764394
And then bypassing varnish and going straight to apache
pete#pete-work ~ $ GET -Sed http://beta.newint.org:8080/user
GET http://beta.newint.org:8080/user
404 Not Found
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
Connection: close
Date: Wed, 27 May 2015 15:14:31 GMT
Server: Apache
Vary: Accept-Encoding
Content-Language: en
Content-Type: text/html; charset=utf-8
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Client-Date: Wed, 27 May 2015 15:14:32 GMT
Client-Peer: 178.79.141.247:8080
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
ImageToolbar: false
Link: <http://beta.newint.org:8080/user>; rel="canonical",<http://beta.newint.org:8080/user>; rel="shortlink"
Title: User account | Site-Install
X-Generator: Drupal 7 (http://drupal.org)
X-Meta-Charset: utf-8
X-Meta-Generator: Drupal 7 (http://drupal.org)
X-Meta-Viewport: width=device-width, maximum-scale = 1.0
X-Powered-By: HHVM/3.7.0
Any ideas?
Turns out this was simply due to mod_rewrite not being enabled.

Apache truncates HTTP header

I'm experimenting a very strange issue: using apache-2.2.25 on an Arch Linux server I get a truncated HTTP header in response, but only under windows machines.
I left untouched the httpd.conf file and I have created a file /srv/http/index.html with inside Hello.
With a web browser on a Linux machine I get correctly visualized the hello page, but under Windows I get
.1 200 OK Date: Fri, 15 Nov 2013 08:44:28 GMT Server: Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/1.0.1e DAV/2 Last-Modified: Fri, 15 Nov 2013 08:15:09 GMT ETag: "27c-a-4eb32cbf8b950" Accept-Ranges: bytes Content-Length: 10 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html; charset=utf-8 Hello
It seems that the http header is truncated for the first characters (HTTP/1).
Have you got any advices?

Switch from Apache Prefork MPM to Worker MPM on CentOS 6.3

So I switched from prefork to worker and now all I am getting is 500 errors when trying to access my site:
HTTP/1.0 500 Internal Server Error
Date: Tue, 16 Apr 2013 05:55:08 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Cache-Control: max-age=31536000
Expires: Wed, 16 Apr 2014 05:55:08 GMT
Vary: Accept-Encoding,User-Agent
Connection: close
Content-Type: text/html; charset=UTF-8
Any idea? What did I miss?
This is what I did:
uncommented HTTPD=/usr/sbin/httpd.worker from /etc/sysconfig/httpd
And installed: yum install php-zts
And just 500 errors, worst thing is, I cant find any logs with any errors...
You should try using FastCGI instead of PHP ZTS to use Apache MPM Worker. As suggested here:
there is a way to get the performance benefits of using a threaded MPM and still use PHP: using FastCGI
and, on official documentation:
If you want to use a threaded MPM, look at a FastCGI configuration where PHP is running in its own memory space.