Configuring Apache / httpd proxy on CentOS
CentOS version: CentOS 7.6.1810
Without SSL
1. Install httpd
sudo yum -y install httpd
2. Set ServerName
sudo echo 'ServerName codeBeamer' >> /etc/httpd/conf/httpd.conf
Create a file with a text editor for example:
sudo vi /etc/httpd/conf.d/default-site.conf
And add the following content. Please replace the following things:
Example
Let's say there are servers, one has a running codeBeamer that is available on the http://172.20.10.10:8080 and the other server that has a running Apache, it is available on http://172.30.20.20:8080. test.codebeamer.com domain points to http://172.30.20.20:80
In this case the configuration should look like that:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://172.20.10.10:8080 retry=1 acquire=3000 timeout=600 keepalive=On
ProxyPassReverse / http://172.20.10.10:8080
RequestHeader set Host test.codebeamer.com
</VirtualHost>
Context path
In order to use a different context with proxy, codeBeamer docker image must be started with CB_CONTEXT_PATH parameter. Let's say you want to run your codeBeamer on the http://mydomain.com/codeBeamer, in this case the value of CB_CONTEXT_PATH=codeBeamer and the proxy setting looks like that
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass /codeBeamer http://172.20.10.10:8080/codeBeamer retry=1 acquire=3000 timeout=600 keepalive=On
ProxyPassReverse /codeBeamer http://172.20.10.10:8080/codeBeamer
RequestHeader set Host mydomain.com/codeBeamer
</VirtualHost>
Please note that CB_CONTEXT_PATH is only supported from 9.4 version
Websocket
Since v10 version websocket protocol is required for codeBeamer application. It must be configured in your proxy server. Please use the following code snippet
<VirtualHost *:80>
...
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule .* "ws://172.20.10.10:8080%{REQUEST_URI}" [P]
...
</VirtualHost>
Please note that rewrite_module must be enabled
With SSL
1. Install httpd
sudo yum -y install httpd
2. Install mod_ssl
sudo yum -y install httpd mod_ssl
3. Set ServerName
sudo echo 'ServerName codeBeamer' >> /etc/httpd/conf/httpd.conf
Create a file with a text editor for example:
sudo vi /etc/httpd/conf.d/default-site.conf
And add the following content. Please replace the following things:
Use SVN
In case you want to use SVN please follow the steps below
1. Install mod_dav_svn
sudo yum -y install mod_dav_svn
2. Create cb-svn.conf
Create a file with a text editor for example
sudo vi cb-svn.conf
Add the following content to cb-svn.conf.
Please replace the following things:
Move the file to /etc/httpd/conf.d/
sudo mv /path/to/your/cb-svn.conf /etc/httpd/conf.d/cb-svn.conf
3. Extend default-site.conf
Add the following lines to default-site.conf inside VirtualHost node
<Location /svn/>
ProxyPass !
</Location>