NextCloud HTTPS (via reverse proxy) and built-in Collabora not working

I have a basic install of NextCloud via Docker with a reverse proxy that listens to HTTPS. I integrated it with postgres, and most of it is working fine except collabora integration.

Here’s my docker-compose.yaml:

version: '3.5'
services:
  postgres:
    container_name: nextcloud_postgres
    image: postgres:alpine
    environment:
      - POSTGRES_DB=<some_db>
      - POSTGRES_USER=<some_user>
      - POSTGRES_PASSWORD=<some_pw>
    volumes:
      - <some_location>:/var/lib/postgresql/data
    networks:
      - <some_network>

  nextcloud:
    container_name: nextcloud
    image: nextcloud
    volumes:
      - <some_location>:/var/www/html
    depends_on:
      - postgres
    networks:
      - <some_network>

I wanted to use the built-in collabora, and seems like the config page looks good:

but on my browser, it keeps trying to hit it via HTTP instead of HTTPS:

Somehow, I feel nextcloud thinks I’m on HTTP still. If I copy that URL and change it to HTTPS, it works, and I get this back:

https://<some_hostname>/custom_apps/richdocumentscode/proxy.php?status
{"status":"OK"}

Is this a bug, or am I missing some configuration?

Apologies, after reading some more of the docker documentation, I found the solution, which is to add the following 2 environment variables to my nextcloud docker-compose.yml:

environment:
  - APACHE_DISABLE_REWRITE_IP=1
  - OVERWRITEPROTOCOL=https