That said, I don’t understand what you’re trying to do. What’s your usecase, exactly? Please explain thoroughly what you’re trying to do and why you need it.
I am actually writing a simple template rendered website that need to render the original request scheme and host from user for something like google scholar spider use.
For example, there is an academy used meta tag called <meta name="citation_pdf_url"> and the content value should be the full URL (but not relative or root-relative ones) of the thesis in PDF format. I am trying to use Caddy to embed the scheme and host of user’s actual request but not hard coded in the server config, in order to serve multiple journals in different domains.
The “<meta>” tags normally apply only to the exact page on which they’re provided. If this page shows only the abstract of the paper and you have the full text in a separate file, e.g., in the PDF format, please specify the locations of all full text versions using citation_pdf_url or DC.identifier tags. The content of the tag is the absolute URL of the PDF file; for security reasons, it must refer to a file in the same subdirectory as the HTML abstract.
<meta name="citation_title" content="The testis isoform of the phosphorylase kinase catalytic subunit (PhK-T) plays a critical role in regulation of glycogen mobilization in developing lung">
<meta name="citation_author" content="Liu, Li">
<meta name="citation_author" content="Rannels, Stephen R.">
<meta name="citation_author" content="Falconieri, Mary">
<meta name="citation_author" content="Phillips, Karen S.">
<meta name="citation_author" content="Wolpert, Ellen B.">
<meta name="citation_author" content="Weaver, Timothy E.">
<meta name="citation_publication_date" content="1996/05/17">
<meta name="citation_journal_title" content="Journal of Biological Chemistry">
<meta name="citation_volume" content="271">
<meta name="citation_issue" content="20">
<meta name="citation_firstpage" content="11761">
<meta name="citation_lastpage" content="11766">
<meta name="citation_pdf_url" content="http://www.example.com/content/271/20/11761.full.pdf">
Alright, well I think the way you’re doing it now is the best way to do it for the time being.
Having configurable “trust” for templates/placeholders is unclear how that would even work. We definitely don’t want to change the existing http.request.scheme placeholders and such, because those should remain pure.
It’s very usecase-specific whether you need to get the value from a header.
FYI, you can use .Req.Header.X-Forwarded-Proto I think instead of placeholder… might not be able to use dashes, might need to use .Req.Header.["X-Forwarded-Proto"] or something, I’m not sure. Modules - Caddy Documentation