简体   繁体   中英

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 ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM