3

I've just completed the installation of Sonatype Nexus 3.2.1-01 and I'm trying to publish some artifacts using a Jenkins job and the Nexus Artifact Uploader 2.9 plugin.

The upload starts fine:

100 % completed (572 kB / 572 kB).

But then it throws the the error:

Return code is: 502, ReasonPhrase:Bad Gateway.

Both the Jenkins and Nexus servers run behind a reverse proxy which I believe are the source of the issue.

The Apache log seems to suggest that the request was not replied by Nexus:

[Thu Apr 06 18:50:46.128569 2017] [proxy:error] [pid 10327] (32)Broken pipe: 
[client some_ip:57928] AH01084: pass request body failed to 0.0.0.0:8081 (0.0.0.0)
[Thu Apr 06 18:50:46.128649 2017] [proxy_http:error] [pid 10327] [client some_ip:57928] AH01097: pass request body failed to 0.0.0.0:8081 (0.0.0.0) from some_ip ()

This is my VirtualHost config in Apache for the Sonar server:

<IfModule mod_ssl.c>
<VirtualHost *:443>
     ServerAdmin some@email.com
     ServerName  some.website.com
     ServerAlias nsome.website.com

     DocumentRoot /srv/www/nexus/public_html/
     ErrorLog /srv/www/nexus/logs/error.log
     CustomLog /srv/www/nexus/logs/access.log combined

     ProxyPreserveHost On
     ProxyPass / http://0.0.0.0:8081/
     ProxyPassReverse / http://0.0.0.0:8081/
     ProxyPassReverse / https://some.website.com/

     SSLCertificateFile /etc/letsencrypt/live/some.website.com/cert.pem
     SSLCertificateKeyFile /etc/letsencrypt/live/some.website.com/privkey.pem
     Include /etc/letsencrypt/options-ssl-apache.conf
     SSLCertificateChainFile /etc/letsencrypt/live/some.website.com/chain.pem
</VirtualHost>
</IfModule>

I've tried to add the following, as explained in other answers, but did not help:

1) Disabling the check on the SSL certificates (although these are valid):

SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off

2) Forcing the requests headers:

RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"

3) Settting the timeouts and keepalive options in the ProxyPass line:

ProxyPass / http://0.0.0.0:8081/ retry=1 acquire=3000 timeout=600 Keepalive=On
iwaseatenbyagrue
  • 3,588
  • 12
  • 22
Tedi
  • 161
  • 1
  • 1
  • 4
  • Is your upstream really set as `http://0.0.0.0:8081/`? If so, that seems like a likely cause of your issue – iwaseatenbyagrue Apr 20 '17 at 16:34
  • My bad. This is was a reminder from the previous configuration but not the actual setup. The problem ended up being with Nexus reporting a bad gateway error while the root cause was an unsupported upload version. I've added the resolution below on the answers. – Tedi Apr 25 '17 at 10:54

1 Answers1

3

At the end the error 502 (bad gateway) had nothing to do with the root cause of the problem. The version listed on the artifact to be published for the snapshot version did not comply with the Nexus policy and this was triggering the error.

Tedi
  • 161
  • 1
  • 1
  • 4