I have to configure an Apache web server as reverse proxy for my Sonarqube. The web server is listening on port 8888 and I enforce the Sonarqube to use only the 127.0.0.1 (sonar.properties):
sonar.web.host=127.0.0.1
and I have the following reverse settings (httpd.conf):
ProxyRequests Off
ProxyPreserveHost On
<VirtualHost *:8888>
ProxyPass /sonar http://127.0.0.1:9000/
ProxyPassReverse /sonar http://127.0.0.1:9000/
</VirtualHost>
By accessing the URL http://10.130.210.80:8888/sonar the opening page from Sonarqube is displayed but without any CSS style and without images. The Apache error.log tells me the following:
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/css, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/js, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/js, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/js, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/js, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/images, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/js, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/images, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/js, referer: http://10.130.210.80:8888/sonar
I got the solution. First, I set a context for the Sonarqube:
sonar.web.context=/sonarqube
Second, for Apache I set the Servername and I set the proxy pass to the Sonarqube's context:
ProxyRequests Off
ProxyPreserveHost On
<VirtualHost *:8888>
ServerName 10.130.210.80:8888
ProxyPass /sonarqube http://127.0.0.1:9000/sonarqube
ProxyPassReverse /sonarqube http://127.0.0.1:9000/sonarqube
</VirtualHost>
and "Tadaaa", works!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.