We recently had an admin make some changes to foreman in updating certificates. One change that was made was to move foreman-proxy to listen on localhost:8000. Everything is working as expected with one exception and that involves importing puppet environments.
First, if you navigate to configure -> classes in foreman and then click on Import Environments, you will get an error message "Unable to get environments from Puppet ". You can get the same message from a couple of other places in the gui. From the foreman cli, running ‘foreman-rake puppet:import:puppet_classes’ will also give you the same error message.
Both of the above actually are doing a web call to foreman-proxy. This can be reproducedwith ‘curl http://127.0.0.1:8000/puppet/environments’, which returns a 404 Not Found error. The proxy works fine however when you run ‘curl http://127.0.0.1:8000/puppet/ca’ or ‘curl http://127.0.0.1:8000/version’.
RELEASE: CentOS Linux release 7.8.2003 (Core)
RUBY: ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
In the proxy log file we get the following every time we try to import the environment
D, [2020-05-21T10:45:29.311591 ] DEBUG – : accept: 127.0.0.1:54400
D, [2020-05-21T10:45:29.313185 ] DEBUG – : Rack::Handler::WEBrick is invoked.
I, [2020-05-21T10:45:29.314537 ] INFO – : 127.0.0.1 - - [21/May/2020:10:45:29 -0400] “GET /puppet/environments HTTP/1.1” 404 27 0.0007
D, [2020-05-21T10:45:29.314974 ] DEBUG – : close: 127.0.0.1:54400