Need help with PXE booting Ubuntu 22.04 on Foreman v 3.5 (nginx), getting 404 Not Found on userdata

I am trying to deploy Ubuntu 22.04 with Foreman v 3.5 running on Nginx, I am specifically having issue with the dynamic userdata API portion which works if I specify the mac address in teh PXELinux APPEND statement as such:
ds=nocloud;s=http://<%= foreman_request_addr %>/userdata/<%= @host.mac %>/
But according to my research and other posts on the forum, the intended was should not require the mac address since Foreman API will serve the right userdata based on the requester?-
ds=nocloud;s=http://<%= foreman_request_addr %>/userdata/

We have a proxy running on the Foreman server itself and it appears the userdata API is accessible if I speicfy the MAC address from port 80 and 3000 but not 8000 which is where the proxy is Listening. Example-
curl -D - -H 'X-FORWARDED-FOR: <pxeboot_client>'<mac_address> /user-data

log I see in the production.log-

[I|app] Started GET "/userdata/user-data for <client_ip> at 2024-01-24 08:40:31 -0500
[I|app] Processing by UserdataController#userdata as TEXT
[E|app] Could not find host for request <client_ip>
[I|app]   Rendered text template (Duration: 0.0ms | Allocations: 2)
[I|app] Filter chain halted as :find_host rendered or redirected
[I|app] Completed 404 Not Found in 12ms (Views: 0.3ms | ActiveRecord: 3.3ms | Allocations: 3100)

Foreman Version: 3.5.1
Foreman-proxy version: 3.5.1

Any help is appreciated and Thank you!

Provisioning Templates attached to the host I am trying to provision:

Host initial configuration template (Linux host_init_ config default)
PXELinux template (Preseed default PXELinux Autoinstall)
User data template (Preseed Autoinstall cloud-init user data)

The client that is trying to get the template needs to have the IP address matching the host in the database. I don’t know if Ubuntu installer (the new one) allows customizing the user-data URL, if that is possible we could inject a UUID token and relax this requirenment.

Correction, cloud-init autoinstall actually have MAC address in the URL!

So it should just work. Not sure what is wrong here.

Hey @foreman_user264!

The MAC-based is the “new” API which we want to use for future deployments. It should work fine if you deploy directly from your Foreman machine. Unfortunately, Smart Proxies do not forward such API endpoint as you found out correctly (see here: Bug #36632: Ubuntu deployment via Smart Proxy fails due to outdated Userdata API - Smart Proxy - Foreman):

In your Foreman version, you should use the non-MAC API endpoint and it should work fine for Foreman and Smart Proxy deployments. But, it is important that you follow the docs for your Smart Proxy-based deployment:

Especially the first step that references the Configuring Smart Proxy for Host Registration and Provisioning is important.

In case your DHCP-setup requires you to use the MAC-based endpoint and you want to deploy through your Foreman only, you should update your Foreman to get the latest templates. Alternatively, you can get the templates and snippets here: