Cloud-init userdata 404

I am using foreman 3.4.1 and trying to boot ubuntu20. also using anther server for proxy, tftp and dhcp
In foreman i have defined a ucloud-init user data template.

When i provision the host (from foreman ui) it is registered with the fallowing ip:
When i reboot it allocates from the dhcp the fallowing temp ip: and because the ip address is different the call to userdata fails.

Processing by UserdataController#metadata as TEXT
2023-04-01T15:45:58 [I|app|49a75511]   Parameters: {"url"=>"", "userdatum"=>{}}
2023-04-01T15:45:58 [E|app|49a75511] Could not find host for request
2023-04-01T15:45:58 [I|app|49a75511]   Rendered text template (Duration: 0.0ms | Allocations: 1)
2023-04-01T15:45:58 [I|app|49a75511] Filter chain halted as :find_host rendered or redirected
2023-04-01T15:45:58 [I|app|49a75511] Completed 404 Not Found in 17ms (Views: 0.5ms | ActiveRecord: 5.8ms | Allocations: 2293)
2023-04-01T15:45:59 [I|app|509b3d4a] Started GET "/userdata/meta-data?" for at 2023-04-01 15:45:59 -0400

but when i call manually with the previous ip address

curl -D - -H 'X-Forwarded-For:'

I get 200.

Any idea what can be done ?