Unable to establish https for sonar with the following configuration - Using Apache proxy

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

We are using : * Enterprise Edition

  • Version 8.2 (build 32929)

  • what are you trying to achieve

Using Apache reverse proxy to setup ssl for sonarqube url for it to work on https

  • what have you tried so far to achieve this

Tried out the official documentation in setting up the configuration file and also referred to some online community posts but no luck . Here is my current configuration.

Our sonar is currently working on : http://sonar.mycompany.com
We are trying to achieve for it to work on https://sonar.mycompany.com

Here is my httpd configuration file.

/etc/httpd/conf/httpd.conf

<VirtualHost *:80>
  ServerName sonar.mycompany.com
  ServerAlias www.sonar.mycompany.com
 # ServerAdmin admin@mycompany.com
  ProxyRequests Off
  ProxyVia On
  ErrorLog /etc/httpd/logs/error_log
  CustomLog /etc/httpd/logs/access_log common
  Redirect permanent / https://sonar.mycompany.com
</VirtualHost>

<VirtualHost *:9000>
  ServerName sonar.mycompany.com
  ServerAlias www.sonar.mycompany.com

  SSLEngine On
  SSLProxyEngine On
  SSLCertificateFile    /etc/pki/tls/certs/server.crt
  SSLCertificateKeyFile /etc/pki/tls/private/server.key

  ProxyRequests     Off

  ProxyPass        / http://sonar.mycompany.com:9000
  ProxyPassReverse / http://sonar.mycompany.com:9000

  RequestHeader set X_FORWARDED_PROTO "https"
  RequestHeader set X-Forwarded-Port "443"
  SetEnv force-proxy-request-1.0 1
  SetEnv proxy-nokeepalive 1

  <Proxy *>
   Order allow,deny
    Allow from all
  </Proxy>
  ProxyPreserveHost on
</VirtualHost>

https://sonar.mycompany.com/ - works
https://sonar.mycompany.com:9000 - doesnt work. This throws the error “ERR_SSL_PROTOCOL_ERROR”

Hi santhosh,

Welcome to the SonarSource Community!

Is there any particular reason why you are virtual hosting HTTPS on *:9000, rather than *:443?

Brian

Hi Brian ,

Thanks for replying.

We have tried with 443 in the virtual host configs too, but that didnt work too.

Do you think apart from that every other thing from my config above looks fine.