Debian provisioning failure due to preseed URL not being set correctly

Problem:
I am attempting to provision a baremetal host using a Foreman smart proxy. I am using what I believe to be the same settings and configuration as another location and smart proxy, but in this instance, provisioning stops after the host has loaded the Debian installer with the message “Failed to retrieve the preconfiguration file”. In particular, the URL has the incorrect domain listed for the smart proxy. If you truncate the domain of the URL to the correct value, you can see the preseed file as expected in the GET response from the host. It makes sense that it fails to retrieve the file given that the URL is incorrect, but I want to understand how this incorrect domain is getting placed in the URL.

We use “domain.com” as the top level domain in our environment, and all hosts with static IP configurations have DNS records generated here. This includes the Foreman server itself (foreman.domain.com), and the smart proxies for other locations (fmproxy-location.domain.com). Hosts that use DHCP to obtain an IP are given DNS records in the “dhcp.domain.com” domain instead, which is what I have configured as the domain setting for hosts built via Foreman (currently Foreman is used to build workstations and other machines that would not have static IP addresses). We do not have Foreman directly control any network services such as DNS or DHCP, it only serves to provision hosts and integrate as the Puppet proxy for the hosts it builds.

When the error appears, the URL shows the host being provisioned is trying to contact the proxy by “http://fmproxy-location.dhcp.domain.com” instead of by the correct “http://fmproxy-location.domain.com.” I find this very puzzling given other location and proxy combinations have not exhibited this behavior, and I was unable to trace which setting in Foreman controls this URL setting in the preseed/installer environment.

My question is, how is the URL for retrieving the preconfiguration file generated in the Foreman Debian provisioning workflow? I am using largely the same settings for another host in another location that is building from a different smart proxy, and it is working correctly, so I want to understand how this URL is generated so I can figure out where to look and how to correct it.

Expected outcome:

Host being provisioned sends a GET request to the proxy, gets the preseed file, and continues with the unattended provisioning.

Foreman and Proxy versions:

Foreman version: 3.0.1
Proxy version: 3.0.2 (location where error is present, upgraded during troubleshooting), 3.0.0 (location where error is not seen)

Foreman and Proxy plugin versions:
foreman_puppet: 1.0.4

Distribution and version:
All Foreman systems are running Ubuntu 20.04 LTS
Systems being provisioned are attempting to install Debian 11

Other relevant data:
iPXE generated template for working host and location:

#!gpxe

kernel http://debianmirror.domain.com/open_source/Debian11/debian/dists/bullseye/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux initrd=initrd.gz interface=auto url=http://foreman.domain.com/unattended/provision?token=<token> ramdisk_size=10800 root=/dev/rd/0 rw auto BOOTIF=01-${netX/mac:hexhyp} hostname=foo-testhost auto=true domain=dhcp.domain.com locale=en_US  hw-detect/load_firmware=false
initrd http://debianmirror.domain.com/open_source/Debian11/debian/dists/bullseye/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz

boot

iPXE template generated for the host that is failing:

#!gpxe

kernel http://debianmirror.domain.com/open_source/Debian11/debian/dists/bullseye/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux initrd=initrd.gz interface=auto url=http://foreman.domain.com/unattended/provision?token=<token> ramdisk_size=10800 root=/dev/rd/0 rw auto BOOTIF=01-${netX/mac:hexhyp} hostname=bar-testhost auto=true domain=dhcp.domain.com locale=en_US  hw-detect/load_firmware=false
initrd http://debianmirror.domain.com/open_source/Debian11/debian/dists/bullseye/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz

boot

Setting for smart proxy that is working as expected when provisioning:

# grep -rEv '(^#|^$|^---)' settings.yml settings.d/templates.yml settings.d/tftp.yml
settings.yml::settings_directory: "/etc/foreman-proxy/settings.d"
settings.yml::daemon: true
settings.yml::http_port: 8000
settings.yml::foreman_url: https://foreman
settings.d/templates.yml::enabled: http
settings.d/templates.yml::template_url: http://fmproxy-foo:8000
settings.d/tftp.yml::enabled: http

Settings for smart proxy that is adding “dhcp.domain.com” to the provisioning URL instead of “domain.com”:

# grep -rEv '(^#|^$|^---)' settings.yml settings.d/templates.yml settings.d/tftp.yml 
settings.yml::settings_directory: "/etc/foreman-proxy/settings.d"
settings.yml::daemon: true
settings.yml::http_port: 8000
settings.yml::foreman_url: https://foreman
settings.d/templates.yml::enabled: http
settings.d/templates.yml::template_url: http://fmproxy-bar:8000
settings.d/tftp.yml::enabled: http

I also checked the debconf-get-selections --installer from a machine that was building correctly, and found:

d-i	preseed/url	string	http://fmproxy-foo.domain.com:8000/unattended/provision?token=<token>

versus the setting when querying the installer after it fails to pull down the preseed file on the other host:

debconf-get preseed/url
http://fmproxy-bar.dhcp.domain.com:8000/unattended/provision?token=<token>

As far as I can tell, one smart proxy attaches dhcp.domain.com to the proxy URL, and one doesn’t. If anyone can help me figure out where this setting is being pulled from, I would greatly appreciate it. If you need any other information from me, please let me know.