Q:

Apache2 Custom header - Adding Remort Port on header

I try to add a custom header on my request, but I'm not sure if it's possible with Apache2.4.
I would like to add to my headers the remote port used by the client.
If I check my logformat, I can get the remote port with this syntax :
%{remote}p
But if I try something like :
Header add x-remote-port %{remote}p
My configtest give me this error :
Unrecognized header format %p
I would like to know if it's possible to get a dynamic variable like remote port to add it on my headers for each requests ?

A:

Log format syntax are differents, so here we go for the header module syntax :
Header add X-remote-port "%{REMOTE_PORT}e"
REMOTE_PORT varirable works only on 2.4.26 and later
https://httpd.apache.org/docs/2.4/expr.html

