Uploaded files can't open and emoticons aren't loaded on Hipchat Server behind proxy
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.
This is for an outdated version of Hipchat Server
This article applies to a version of Hipchat Server which will be deprecated soon. After that period the version will no longer be supported.
You should upgrade to a more recent version of Hipchat Server as soon as you can to take advantage of new features, and security and bug fixes.
At this time, we don't officially support Hipchat Server behind a proxy/load balancer hence we can't guarantee that it will work without any issue. We have a feature request raised regarding this matter at: - HCPUB-318Getting issue details... STATUS which you can vote and subscribe to.
Problem
The links of uploaded file can't open and emoticons are not loaded after Hipchat Server behind a proxy.
For example, you may see emoticon is accessed on HTTP instead of the expected HTTPS in /var/log/hipchat/web.log:
2017-02-07T20:30:50.178069+00:00 hipchat web[5354]: /index#REQF20447 uid-1 5ms [info] === REQUEST START === url: http://hipchat.atlassian.com/files/img/emoticons/smile.png, method: GET, referrer: https://hipchat.atlassian.com/chat/room/2, server: , remote_addr: 172.31.32.1, user_agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.1 Safari/537.36, x_hipchat_request: public, x_forwarded_for: 65.223.61.1
You may also see the following error in /var/log/hipchat/web.log when accessing a file link:
2017-02-07T21:41:14.773336+00:00 hipchat web[10362]: /index#REQF1F9AB uid-anon 5ms [info] 404 - page does not exist: https://hipchat.atlassian.com/files/photos/111/SZlNITZopnMutlf_125.jpg
Diagnosis
- Double check if trusted SSL certificate is installed on the server
- Temporarily bypass proxy/load balancer in front of the server and check if the file links would open and emoticons would loaded up.
Cause
SSL termination at the load balancer and proxying to port 80 within Hipchat caused the problem. Hipchat's NGINX site configuration for 000-web (/etc/nginx/sites-available/000-web & /etc/nginx/sites-enabled/000-web) is missing or does not include the following for the listener on port 80 as compared to port 443:
include includes/files-site;
Workaround
Specify the following in port 80 directive in nginx files (/etc/nginx/sites-available/000-web & /etc/nginx/sites-enabled/000-web):
include includes/files-site;
Restart Hipchat Services for the changes to take effect:
hipchat service --restart
The changes to 000-web will be overwritten with the stock configuration if the server is rebooted or if any configuration change is made in the Hipchat UI that triggers a full service restart of Hipchat Server. To avoid losing customizations made to 000-web, please ensure that a script is added /home/admin/startup_scripts to restore any custom settings.