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.
nitpick: this `{` should be on it's own line, as it breaks the style guide and thus rubocop fails: http://ci.theforeman.org/job/test_develop_pr_rubocop/1047/checkstyleResult/new/