HTTP status 500 when using Nginx with Jenkins

David Aldrich David.Aldrich at EMEA.NEC.COM
Wed Sep 6 15:15:11 UTC 2023


Hi

We are using Nginx as a reverse proxy, connected to a Jenkins continuous integration server, to provide https access. Jenkins and Nginx run on the same Linux server.

A certain Jenkins function is failing when accessed via https. It works correctly when accessed via http (without nginx). Therefore, we suspect that something is wrong with our Nginx configuration.

In the failure condition, the browser (Edge) shows (in Developer Tools Console):

        POST https://jenkins-temptest.<snip>/pipeline-syntax/generateSnippet 500

I don't know how to access the contents of the 500 reply.

Our /etc/nginx/nginx.conf contains:

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        types_hash_max_size 2048;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # SSL Settings
        ##

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

Our /etc/nginx/conf.d/ssl.conf contains:

server {

    listen 443 ssl http2;
    listen       [::]:443 ssl http2;

#    ssl                        on;
    ssl_certificate     /etc/nginx/certs/jenkins-temptest.pem;
    ssl_certificate_key /etc/nginx/certs/jenkins-temptest.key;

    server_name jenkins-temptest.<snip>;

    location / {
      sendfile off;
      proxy_pass                "http://127.0.0.1:8080";
      proxy_redirect            default;
#      proxy_http_version        1.1;
      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-Host        $host;
      proxy_set_header          X-Forwarded-Port        443;
      proxy_set_header          X-Forwarded-Proto       $scheme;

      #this is the maximum upload size
      client_max_body_size       20m;
      client_body_buffer_size    128k;

      proxy_connect_timeout      90;
      proxy_send_timeout         90;
      proxy_read_timeout         90;
      proxy_request_buffering    off; # Required for HTTP CLI commands in Jenkins > 2.54
      proxy_set_header Connection ""; # Clear for keepalive
    }
        location ^~ /script {
            return 404;
    }

    location ^~ /manage/script {
            return 404;
    }
#    index index.html index.htm;
}

Is anything obviously wrong with these?

Best regards
David



More information about the nginx mailing list