Unable to redirect to truenas homepage

1. The problem I’m having:

I am trying to make it so my local network can resolve the following:
http://{$MY_DOMAIN}.club to http://{$SERVER_IP}.club:82
https://{$MY_DOMAIN}.club to https://{$SERVER_IP}.club:8443

The server is a truenas system, with the port for http changed to 82, and https to 8443 (so that caddy would work, as it takes control over those ports).

Problem is, the server hostname is “truenas”, which I do not want to change as other internal apps are set to use it, and I do not want them to use a full domain with tld incase they reach outside of my network should caddy go down or my gateway lost its DNS A-Records.

Currently:
https://MY_DOMAIN.club/ > redirects to IP

https://MY_DOMAIN.club/ui/signin > goes through fine no issues

HTTPS is working via DNS=01 challenge on the domain with .club TLD when it doesn’t redirect to IP. I have a domain registered pointing to local IP of the server. Domain with .com tld uses self-signed cert, not that this matters for the issue.

2. Error messages and/or full log output:

PASTE OVER THIS HERE IN THIS CODE BLOCK.
Please ensure it looks nice.

3. Caddy version:

v2.11.4

4. How I installed and ran Caddy:

Built with porkbun with custom dockerfile.
Dockerfile:

FROM caddy:2-builder AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/porkbun

FROM caddy:2

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

a. System environment:

Truenas 25.04

Docker

b. Command:

PASTE OVER THIS HERE IN THIS CODE BLOCK.
Please ensure it looks nice.

c. Service/unit/compose file:

services:
  caddy:
    build: .
    container_name: caddy
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
      - 443:443/udp
    volumes:
      - /mnt/apps/configs/caddy:/etc/caddy
      - /mnt/apps/data/caddy:/data
    env_file:
      - .env
    environment:
      #Set variables to the .env value so caddyfile can use variable syntax that works in all fields
      - TZ=Australia/Adelaide
      - PORKBUN_API_KEY=${PORKBUN_API_KEY}
      - PORKBUN_API_SECRET_KEY=${PORKBUN_API_SECRET_KEY}
      - MY_DOMAIN=${MY_DOMAIN}
      - SERVER_IP=${SERVER_IP}
networks: {}

d. My complete Caddy config:

 # Global configuration block - sets up Porkbun for DNS challenges 
 { 
     acme_dns porkbun { 
         api_key {$PORKBUN_API_KEY} 
         api_secret_key {$PORKBUN_API_SECRET_KEY} 
     } 
 } 

 vpn.{$MY_DOMAIN}.club { 
     reverse_proxy https://{$SERVER_IP}:51820 
 } 

 jellyfin.{$MY_DOMAIN}.club { 
     reverse_proxy https://{$SERVER_IP}:3020 
 } 

 seerr.{$MY_DOMAIN}.club { 
     reverse_proxy https://{$SERVER_IP}:5055 
 } 

 # Internal domain HTTP proxies to TrueNAS HTTP (port 82) 
 {$MY_DOMAIN}.com:80 { 
     reverse_proxy http://{$SERVER_IP}:82 
 } 

 # Public domain HTTP proxies to TrueNAS HTTP (port 82) 
 {$MY_DOMAIN}.club:80 { 
     reverse_proxy http://{$SERVER_IP}:82 
 } 

 # Public domain HTTPS proxies to TrueNAS HTTPS (port 8443) 
 {$MY_DOMAIN}.club:443 { 
     reverse_proxy https://{$SERVER_IP}:8443 { 
         transport http { 
             tls_insecure_skip_verify 
         } 
     } 
 } 

 # Internal domain HTTPS proxies to TrueNAS HTTPS (port 8443) with internal cert 
 {$MY_DOMAIN}.com:443 { 
     tls internal 
     reverse_proxy https://{$SERVER_IP}:8443 { 
         transport http { 
             tls_insecure_skip_verify 
         } 
     } 
 } 

I also use this for the .env file:

PORKBUN_API_KEY=REDACTED
PORKBUN_API_SECRET_KEY=REDACTED
MY_DOMAIN=vault
SERVER_IP=10.33.2.155