Variable expansion and proxy headers

1. The problem I’m having:

I want to pass the Origin header with reverse_proxy.

What I found are these docs for variable expansion

But the docs mention header_up Host {upstream_hostport} which is not listed.

IIUC header_up Origin {>Origin} should work - but where are the docs on the “>” syntax?

Or should it maybe be header_up Origin {http.request.header.Origin}?

2. Error messages and/or full log output:

NA

3. Caddy version:

caddy:2.7.6-alpine

4. How I installed and ran Caddy:

k3s

a. System environment:

k3s

b. Command:

NA

d. My complete Caddy config:

NA

5. Links to relevant resources:

NA

That doesn’t exist, that was a Caddy v1 syntax. Caddy v2 was a rewrite, so any information you found from before 2020 is invalid.

What do you mean “not listed”?

All request headers are passed through transparently to the upstream. You don’t need to do anything.

Please completely fill out the help topic template as per the forum rules. This is very much an https://xyproblem.info/ type of question because you’re not actually asking what problem you’re trying to solve. You didn’t show your config, you didn’t show any error etc.

It’s always applicable. Don’t assume it’s not. Always fill out the entire template, as per the forum rules.

1 Like

That doesn’t exist, that was a Caddy v1 syntax

OK.

What do you mean “not listed”?

Searching here: JSON Config Structure - Caddy Documentation
How else would I know what placeholders are available for expansion?

All request headers are passed through transparently to the upstream. You don’t need to do anything.

Ah, sorry - I just misread this part here reverse_proxy (Caddyfile directive) — Caddy Documentation

“By default, Caddy passes thru incoming headers—including Host —to the backend without modifications, with three exceptions”

That’s pretty clear now :slight_smile:

Please completely fill out the help topic template as per the forum rules. This is very much an https://xyproblem.info/ type of question because you’re not actually asking what problem you’re trying to solve. You didn’t show your config, you didn’t show any error etc.

Well, I usually do - but I am asking for details on the docs. And I don’t have a error message.
So I am not quite sure what to put into the template.
I don’t think it is an xyproblem at this stage.

I guess this mostly resolved itself if all headers get passed by default.
Thanks!

But I still don’t see where upstream_hostport is documented to be available for expansion.
Not related - but have you a pointer for the future?

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.