[exim] Re: headers_add :at_start: in routers

Top Page
Delete this message
Reply to this message
Author: Anton
Date:  
To: exim-users
Subject: [exim] Re: headers_add :at_start: in routers

Jeremy Harris via Exim-users wrote on 14-05-24 00:04:
> On 13/05/2024 17:02, Anton via Exim-users wrote:
>> Accordingly to the Googles' recent changes
>> https://support.google.com/a/answer/81126?visit_id=638483404863497961-2571982079
>> https://support.google.com/a/answer/175365?hl=en&ref_topic=1354753
>>
>> messages forwarded to Gmail should contain X-Forwarded-For: or X-Forwarded-To: headers.
>>
>> What is the best way to add them?
>>
>> My problem is that I'm aware a message is forwarded only at the routers level
>> (the final destination e-address is taken from /etc/aliases or ~/.forward)
>> and :at_start: option does not seems to work in transports:
>> the directive
>> headers_add = :at_start:X-Forwarded-For: $acl_m_For
>> adds the header in the main block and not in the beginning, which makes it useless.
>
> The second page you refer to does not specify a position a position in
> the headers where an X-Forwarded-For: header should be added.
>
> Your term "in the main block" is not common usage, so I am uncertain as to your
> thinking.


Sorry, I don't know the right terms. What I called the "main block" is the set of To: From: Date: Message-ID: and alike headers
versus the "flow" of Received: Authentication-Results: etc. headers added at each hop during message transit.

>
> Do you have specific reason to think that the position that Exim's transports
> place a header when specified by a transport or router option (not "directive")
> is not useful?


Since a mail can be forwarded several times before reaching its final destination, it looks logical to put X-Forwarded header(s) at each hop [where it was forwarded].

Here is how the headers looks when Google forwards a mail themselves:

Received: from google.com by final.destination
X-Forwarded-To: final@address
X-Forwarded-For: initial.address@???
Received: from first.MTA by mx.google.com
Received: from MUA by first.MTA
To: initial.address@???
Message-ID: xxx

(mixed with different DKIM/ARC/Authentication-Results headers at each hop).

This comportment could be reached by supporting ":at_start:" option in routers/transports headers_add.

Thank you Jeremy for your answer.

A.

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/