Configuring HQ and Agents to use a Reverse Proxy and Subdomains
HQ and Agents can be configured to use a reverse proxy and sub-domains. A reverse proxy appears as an ordinary web server to the client. In this model, the client makes ordinary requests for content in the namespace of the reverse proxy, which then decides where to send those requests and returns the content as if it were itself the origin.
There are three configuration steps that are needed:
Configuring hq.vmoptions
Setting the baseUrl
Configuring the Reverse Proxy
Configuring hq.vmoptions
Go to [HQ install dir] and edit hq.vmoptions to set -Dport to a custom port as appropriate, for example
-Dport=4000
Setting the baseUrl
In hq-home/config/config.yml, set the baseUrl as a root parameter with the desired public URL (proxy), for example:
baseUrl: http://hq.your_server.com
Configuring the Reverse Proxy
The following example uses Apache - see Notes for other solutions.
To configure Apache Reverse Proxy, use the ProxyPass and ProxyPassReverse directives to configure proxying a public URL, for example http://hq.your_server.com:80, to the proxy URL, for example http://127.0.0.1:4000.
An example is shown below:
<VirtualHost *:80>
ServerName hq.your_server.com
ProxyRequests Off
ProxyVia Off
ProxyPass "/" http://127.0.0.1:4000/
ProxyPassReverse "/" http://127.0.0.1:4000/
ProxyPass /app http://127.0.0.1:4000/app
ProxyPassReverse /app http://127.0.0.1:4000/app
ProxyPass /api http://127.0.0.1:4000/api
ProxyPassReverse /api http://127.0.0.1:4000/api
ProxyPass /sock http://127.0.0.1:4000/sock
ProxyPassReverse /sock http://127.0.0.1:4000/sock
</VirtualHost>
NOTES