Hi.
Thanks for this thread, your solution does the trick in my case.
Did you eventually find a proper solution? I seem to be struggling with the same issue, see https://community.theforeman.org/t/foreman-cant-connect-to-puppetdb/17979.
Are you doing this on Debian, by any chance?