Fixes #8267 - accept template_url in call to foreman from proxy

Also passes the ?static parameter on correctly.

@witlessbird @dustints could you comment and/or test? This will cut down on calls to /templateServer.

See also https://github.com/theforeman/smart-proxy/pull/232
why `|| nil`? this only converts false to nil, otherwise has no effect, was this intended?