Base url generation doesn't take into account HTTP/HTTPs access
Summary
Base url generation doesn't take into account HTTP/HTTPs access
Steps to reproduce
Setup gitlab-ce as: network: Internet -https-> proxy -http-> docker instance No external_url defined
Expected behavior
Go to a build page: https://FQDN/user/project/builds/36 Console shows build output
Actual behavior
Console keeps on turning (no output). Why ? The browser tries to fetch http://FQDN/user/project/builds/36.json instead of https://FQDN/user/project/builds/36.json (HTTP vs HTTPs) and it doesn't work because of security concerns.
When accessing the url manually it works. So it's purely a problem of detecting if the url is HTTP or HTTPs
Results of GitLab environment info
GitLab 8.13.3
GitLab Shell 3.6.6
GitLab Workhorse 0.8.5
GitLab API v3
Git 2.7.4
Ruby 2.3.1p112
Rails 4.2.7.1
PostgreSQL 9.2.18