Maxence
Maxence

Reputation: 313

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 ?

Upvotes: 1

Views: 1495

Answers (1)

Maxence
Maxence

Reputation: 313

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

Upvotes: 1

Related Questions