Refs #969 - Foreman-side changes for serving templates from the proxy

Needs the proxy-side PR to function.

This is a rebase of @GregSutcliffe's original https://github.com/theforeman/foreman/pull/751.
```!host.try(:token).nil?``` is a bit hard to read, try ```host.try(:token).present?```, same for just ```proxy```, ```proxy.present?``` is a tad more explicit.