Project

General

Profile

Puma::HttpParserError: Invalid HTTP format, parsing fails.

Added by Pasha Shtanko 9 months ago

Hi.
I encountered this problem in Redmine 5.1.1

Redmine 5.1.1 (docker)
Environment:
  Redmine version                5.1.1.stable
  Ruby version                   3.2.3-p157 (2024-01-18) [x86_64-linux]
  Rails version                  6.1.7.6
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
Redmine settings:
  Redmine theme                  Tw-style (includes JavaScript)
SCM:
  Subversion                     1.14.2
  Mercurial                      6.3.2
  Bazaar                         3.3.2
  Git                            2.39.2
  Filesystem                     
  Gitlab                         4.14.0
Redmine plugins:
  redmine_agile                  1.6.6
  redmine_checklists             3.1.22
  redmine_gitlab_adapter         0.2.0
  redmine_hourglass              1.3.0-dev
  redmine_resources              2.0.0
  redmine_wysiwyg_editor         0.32.0
  redmineup_tags                 2.0.13

I have a php script (PHP 8.2, via Redmine RestAPI) that closes tasks in Redmine based on a certain status and tracker. After updating Redmine to v. 5.1.1 (old. v. 4.1.5) when I run this script I get an error:

024-02-27T08:13:14.382534085Z 2024-02-27 10:13:14 +0200 HTTP parse error, malformed request ("GET /issues.json" - (-)): #<Puma::HttpParserError: Invalid HTTP format, parsing fails. Are you trying to open an SSL connection to a non-SSL Puma?>
2024-02-27T08:13:14.384183564Z 2024-02-27 10:13:14 +0200 HTTP parse error, malformed request ("GET /issues.json" - (-)): #<Puma::HttpParserError: Invalid HTTP format, parsing fails. Are you trying to open an SSL connection to a non-SSL Puma?>
2024-02-27T08:13:14.385722548Z 2024-02-27 10:13:14 +0200 HTTP parse error, malformed request ("GET /issues.json" - (-)): #<Puma::HttpParserError: Invalid HTTP format, parsing fails. Are you trying to open an SSL connection to a non-SSL Puma?>
2024-02-27T08:13:14.387330008Z 2024-02-27 10:13:14 +0200 HTTP parse error, malformed request ("GET /issues.json" - (-)): #<Puma::HttpParserError: Invalid HTTP format, parsing fails. Are you trying to open an SSL connection to a non-SSL Puma?>

I'm using nginx reverse proxy on another server to use Redmine over https. The previous version of Redmine 4.1.5 (without Puma) worked perfectly when running my on php script.
Tell me what I should fix in the configuration to eliminate this error.
Thank you in advance.


Replies (2)

RE: Puma::HttpParserError: Invalid HTTP format, parsing fails. - Added by Holger Just 9 months ago

Please show your current nginx and puma config.

RE: Puma::HttpParserError: Invalid HTTP format, parsing fails. - Added by Pasha Shtanko 9 months ago

  • nginx configuration
    server {
        listen 80;
        server_name redmine.domain.com;
        return 301 https://$host$request_uri;
    }
    
    server {
    
        listen 443 ssl;
        server_name redmine.domain.com;
    
        ssl_certificate           /etc/ssl/certs/domain.crt;
        ssl_certificate_key       /etc/ssl/private/domain.key;
    
        ssl_verify_client off;
    
        ssl_session_cache  builtin:1000  shared:SSL:10m;
        ssl_protocols  TLSv1.2 TLSv1.3;
        ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
        ssl_prefer_server_ciphers on;
    
        access_log            /var/log/nginx/redmine_access.log;
        error_log             /var/log/nginx/redmine_error.log;
    
        client_max_body_size 0;
    
        location / {
    
          proxy_set_header        Host $host;
          proxy_set_header        X-Real-IP $remote_addr;
          proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header        X-Forwarded-Proto $scheme;
    
          #buffers 4k -> 128k
          proxy_buffer_size          128k;
          proxy_buffers              4 256k;
          proxy_busy_buffers_size    256k;
    
          # Fix the “It appears that your reverse proxy set up is broken" error.
          proxy_pass          http://172.31.100.4:3000;
          proxy_read_timeout  90;
    
          proxy_redirect      http://172.31.100.4:3000 https://redmine.domain.com;
        }
      }
    
    
  • According to the puma configuration, I don’t know where you can look it up.
    I updated redmine via the official docker image, in the Gemfile, the installation was specified as 'gem puma'.
    In the log I see this:
    2024-01-23T22:07:54.671524239Z Puma starting in single mode...
    2024-01-23T22:07:54.671531039Z * Puma version: 6.4.2 (ruby 3.2.3-p157) ("The Eagle of Durango")
    2024-01-23T22:07:54.671535736Z *  Min threads: 0
    2024-01-23T22:07:54.671540071Z *  Max threads: 5
    2024-01-23T22:07:54.671544446Z *  Environment: production
    2024-01-23T22:07:54.671548845Z *          PID: 1
    2024-01-23T22:07:54.671562036Z * Listening on http://0.0.0.0:3000
    
    (1-2/2)