Dmitry, what would be your preferred way of solving this? Easiest would be to introduce a parameter like force_legacy to load puppet directly again. However, For some reason setting puppet_version to 3.8.7 on such a setup still doesn't make the classes show up in the Foreman UI, although the proxy seems to work correctly now:
D, [2017-06-11T13:38:25.108292 ] DEBUG -- : Scanning stdlib classes in /etc/puppet/environments/production/modules/stdlib/manifests/init.pp
D, [2017-06-11T13:38:25.108556 ] DEBUG -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
D, [2017-06-11T13:38:25.112951 ] DEBUG -- : Scanning stdlib classes in /etc/puppet/environments/production/modules/stdlib/manifests/stages.pp
D, [2017-06-11T13:38:25.113154 ] DEBUG -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
D, [2017-06-11T13:38:25.116847 ] DEBUG -- : Scanning ntp classes in /etc/puppet/environments/production/modules/ntp/manifests/service.pp
D, [2017-06-11T13:38:25.117197 ] DEBUG -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
D, [2017-06-11T13:38:25.122742 ] DEBUG -- : Scanning ntp classes in /etc/puppet/environments/production/modules/ntp/manifests/config.pp
D, [2017-06-11T13:38:25.122941 ] DEBUG -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
D, [2017-06-11T13:38:25.126838 ] DEBUG -- : Scanning ntp classes in /etc/puppet/environments/production/modules/ntp/manifests/init.pp
D, [2017-06-11T13:38:25.127080 ] DEBUG -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
D, [2017-06-11T13:38:25.131901 ] DEBUG -- : Scanning ntp classes in /etc/puppet/environments/production/modules/ntp/manifests/install.pp
D, [2017-06-11T13:38:25.132180 ] DEBUG -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
D, [2017-06-11T13:38:25.138879 ] DEBUG -- : Scanning ntp classes in /etc/puppet/environments/production/modules/ntp/manifests/params.pp
D, [2017-06-11T13:38:25.139082 ] DEBUG -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
I, [2017-06-11T13:38:25.143973 ] INFO -- : 192.168.122.241 - - [11/Jun/2017 13:38:25] "GET /puppet/environments/production/classes HTTP/1.1" 200 2 0.2080