Issues running Grafana with Apache2 reverse proxy

Hi,

When trying to visit the url (as admin): https://gitlab.domain.com/-/grafana I am encountered with a 404 Page not found error.

I am using a standalone version of Apache (reverse proxy) with the following configuration:

<VirtualHost *:80>
  ServerName gitlab.domain.com
  ServerSignature Off
  ProxyPreserveHost On

  # Ensure that encoded slashes are not decoded but left in their encoded state.
  # http://doc.gitlab.com/ce/api/projects.html#get-single-project
  AllowEncodedSlashes NoDecode



  <Location />
    # New authorization commands for apache 2.4 and up
    # http://httpd.apache.org/docs/2.4/upgrading.html#access
    Require all granted

    #Allow forwarding to gitlab-workhorse
    ProxyPassReverse http://127.0.0.1:8181
    ProxyPassReverse http://domain.com/
  </Location>

<Location /-/grafana>
Require all granted
ProxyPassReverse http://127.0.0.1:3000/
ProxyPassReverse http://domain.com/
</Location>

  # Apache equivalent of nginx try files
  # http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files
  # http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab
  RewriteEngine on

  # needed for downloading attachments
  DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
#Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.
  ErrorDocument 404 /404.html
  ErrorDocument 422 /422.html
  ErrorDocument 500 /500.html
  ErrorDocument 502 /502.html
  ErrorDocument 503 /503.html

  # It is assumed that the log directory is in /var/log/httpd.
  # For Debian distributions you might want to change this to
  # /var/log/apache2.
  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
  ErrorLog /var/log/httpd/logs/domain.com-gitlab_error.log
  CustomLog /var/log/httpd/logs/domain.com-gitlab_forwarded.log common_forwarded
  CustomLog /var/log/httpd/logs/domain.com-gitlab_access.log combined env=!dontlog
  CustomLog /var/log/httpd/logs/domain.com-gitlab.log combined

RewriteCond %{SERVER_NAME} =gitlab.domain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>

and https:

<IfModule mod_ssl.c>
SSLStaplingCache shmcb:/var/run/apache2/stapling_cache(128000)
<VirtualHost *:443>
  ServerName gitlab.domain.com
  ServerSignature Off

  ProxyPreserveHost On

  # Ensure that encoded slashes are not decoded but left in their encoded state.
  # http://doc.gitlab.com/ce/api/projects.html#get-single-project
  AllowEncodedSlashes NoDecode

  <Location />
    # New authorization commands for apache 2.4 and up
    # http://httpd.apache.org/docs/2.4/upgrading.html#access
    Require all granted

    #Allow forwarding to gitlab-workhorse
    ProxyPassReverse http://127.0.0.1:8181
    ProxyPassReverse http://domain.com/
  </Location>

<Location /-/grafana>
Require all granted
ProxyPreserveHost On
ProxyPass http://localhost:3000/
ProxyPassReverse http://localhost:3000/
</Location>

RequestHeader set Host "gitlab.domain.com"
RequestHeader add X-Forwarded-Ssl on
#RequestHeader set X-Forwarded-For "%<span class="pl-s1"><span class="pl-pse">{</span>REMOTE_ADDR<span class="pl-pse">}</span></span>e"
RequestHeader set X-Forwarded-Proto "https"
  # Apache equivalent of nginx try files
  # http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files
  # http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab
  RewriteEngine on

  #Forward all requests to gitlab-workhorse except existing files like error documents
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
  RewriteCond %{REQUEST_URI} ^/uploads/.*
  RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA]
  # needed for downloading attachments
  DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public

  #Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.
  ErrorDocument 404 /404.html
  ErrorDocument 422 /422.html
  ErrorDocument 500 /500.html
  ErrorDocument 502 /502.html
  ErrorDocument 503 /503.html

  # It is assumed that the log directory is in /var/log/httpd.
  # For Debian distributions you might want to change this to
  # /var/log/apache2.
  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
  ErrorLog /var/log/httpd/logs/domain.com-gitlab_error.log
  CustomLog /var/log/httpd/logs/domain.com-gitlab_forwarded.log common_forwarded
  CustomLog /var/log/httpd/logs/domain.com-gitlab_access.log combined env=!dontlog
  CustomLog /var/log/httpd/logs/domain.com-gitlab.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
#Header always set Strict-Transport-Security "max-age=31536000"
SSLUseStapling on
Header always set Content-Security-Policy upgrade-insecure-requests
SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
#Header always set Strict-Transport-Security "max-age=31536000"
</VirtualHost>
</IfModule>

Output sudo gitlab-ctl status

run: alertmanager: (pid 22036) 68276s; run: log: (pid 4704) 309521s
run: gitaly: (pid 22057) 68275s; run: log: (pid 4710) 309521s
run: gitlab-exporter: (pid 22078) 68275s; run: log: (pid 4695) 309521s
run: gitlab-workhorse: (pid 22080) 68274s; run: log: (pid 4701) 309521s
run: grafana: (pid 22114) 68274s; run: log: (pid 7261) 72089s
run: logrotate: (pid 23740) 3472s; run: log: (pid 4705) 309521s
run: node-exporter: (pid 22141) 68273s; run: log: (pid 4688) 309521s
run: postgres-exporter: (pid 22149) 68273s; run: log: (pid 4719) 309521s
run: postgresql: (pid 22160) 68272s; run: log: (pid 4687) 309521s
run: prometheus: (pid 22246) 68272s; run: log: (pid 4697) 309521s
run: redis: (pid 22263) 68271s; run: log: (pid 4708) 309521s
run: redis-exporter: (pid 22269) 68271s; run: log: (pid 4702) 309521s
run: sidekiq: (pid 22279) 68268s; run: log: (pid 4689) 309521s
run: unicorn: (pid 22292) 68267s; run: log: (pid 4706) 309521s

Output curl localhost:3000

<a href="/-/grafana/login">Found</a>.

Admin area:


Url visit:

I most recently port forwarded the localhost:3000 from remote to localhost:3000 locally. Unfortunately I am left with the following which leaves me to guess that something went wrong during installation:

I hope someone is able to help.

Regards,

Moustafa