Issue with using docker gitlab and apache http proxy for ssl

I’m trying to use a combination of gitlab for docker and apache to serve SSL requests.

Here is my config:

docker compose

version: '3.6'
services:
  web:
    image: 'gitlab/gitlab-ce:15.3.3-ce.0'
    restart: always
    hostname: 'gl1.example.com'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://gl1.example.com:8888'
        # Add any other gitlab.rb configuration here, each on its own line
    ports:
      - '8888:8888'
      - '8443:8443'
      - '2022:22'
    volumes:
      - '$GITLAB_HOME/config:/etc/gitlab'
      - '$GITLAB_HOME/logs:/var/log/gitlab'
      - '$GITLAB_HOME/data:/var/opt/gitlab'
    shm_size: '256m'

apache config

<VirtualHost *:80>
  ServerName gl1.example.com
  RewriteEngine On
  RewriteRule ^/?(.*) https://%{SERVER_NAME}:443/$1 [R,L]
RewriteCond %{SERVER_NAME} =gl1.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
  ServerName gl1.example.com
  # Can't use Location block since it would overshadow all the other proxypass directives on CentOS
  ProxyPreserveHost On
  ProxyRequests Off
  ProxyPass / http://127.0.0.1:8888/ retry=0
  ProxyPassReverse / http://127.0.0.1:8888/
  ServerAlias gl1.example.com
SSLCertificateFile /etc/letsencrypt/live/gl1.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/gl1.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

The problem with this config is that some links, not all, point to http://gl1.example.com:8888

Now I understand that for external_url I really want https://gl1.example.com, but when I do this, everything breaks and I get Apache proxy errors.

I’m using apache to maintain Let’s Encrypt and other name based virtual hosts. Specifically items in the Issues Board, the links present themselves as http://gl1.example.com:8888, which results in a 404, when I really just want https://gl1.example.com.

gitlab-ce:15.3.3-ce.0