Error 500 on git operation using HTTP(S) with Apache as Reverse Proxy
Summary
For any git operation using the HTTP(s) transport layer, there is an error 500 during the authentication step.
In the production.log this error can be found :
JWT::DecodeError (Nil JSON web token):
lib/gitlab/workhorse.rb:120:in `verify_api_request!'
app/controllers/projects/git_http_client_controller.rb:154:in `verify_workhorse_api!'
lib/gitlab/questure_profiler/middleware.rb:15:in `call'
lib/gitlab/middleware/go.rb:16:in `call'
This behaviour occurs only if Apache is used as a frontend proxy even with the official receipe provided here : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/web-server/apache.
If we use NGINX (With Omnibus package or in standalone mode), the git operations works perfectly. I think it's an interface issue between workhorse and apache because of the headers.
Steps to reproduce
Install Gitlab omnibus package and configure a reverse proxy using Apache with this configuration : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/web-server/apache
Expected behavior
The git operations should work.
Actual behavior
Error 500 is raised with the following log :
JWT::DecodeError (Nil JSON web token):
lib/gitlab/workhorse.rb:120:in `verify_api_request!'
app/controllers/projects/git_http_client_controller.rb:154:in `verify_workhorse_api!'
lib/gitlab/questure_profiler/middleware.rb:15:in `call'
lib/gitlab/middleware/go.rb:16:in `call'
Results of GitLab application Check
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... skipped (no tmp uploads folder yet)
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ...
2/2 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.1)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.7.4)
Active users: 2
Checking GitLab ... Finished
Results of GitLab environment info
System information
System: Ubuntu 16.04
Current User: git
Using RVM: no
Ruby Version: 2.3.1p112
Gem Version: 2.6.6
Bundler Version:1.13.1
Rake Version: 10.5.0
Sidekiq Version:4.1.4
GitLab information
Version: 8.12.4
Revision: ba8aeb7
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
GitLab Shell
Version: 3.6.1
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git