[squid-users] I want to display indirect_client_address on error page.

Amos Jeffries squid3 at treenet.co.nz
Thu Aug 6 12:11:43 UTC 2015

On 6/08/2015 5:27 p.m., Kazuhiro Asakura wrote:
> Thank you Amos,
> From: Amos Jeffries
>>> I use "follow-x-forwarded-for" feature, and logged end point IP address.
>>> Also, I created customized error page for end user. but, env %i of
>>> error page does not be translate to end point IP address.
>> More correctly it is the direct endpoint of the client TCP connection.
>> Not the chain of multiple TCP connections, which may include NAT or
>> other protocol translations between Squid and a user.
> Sorry, My description not enough.
> In this environment, BIG-IP exist between end point PC and Squid.
> BIG-IP do NAT, and add X-FORWARDED-FOR header.
> BIG-IP include IP address of endpoint PC for X-FORWARDED-FOR header.
> So, I use follow-x-forwarded-for feature, and get endpoint PC IP address .


> This time, endpoint PC IP address is written into Squid access.log.
> Maybe, source code is below,
> AccessLogEntry.cc
> ----
>     if (Config.onoff.log_uses_indirect_client && request)
>         log_ip = request->indirect_client_addr;
>     else
> #endif
> ----

Yes. Correct.

> But, it is not assigned to environment variable of error page.

Correct. That is a bug, but not easily solved.

> If environment variable of error page could support "indirect_client_addr",
> I would really appreciate it.


>>> I want to display the address of end point to error page.
>>> If someone could suggest solution, I would really appreciate it.
>> The easiest approach I think would be to add a javascript snippet in
>> place of the %i code that locates the users IP address and displays it
>> to them.
> I feel that way is difficult.
> Because, solution of javascript only works JScript, or require STUN server.

STUN ? I dont understand why that would be relevant.

If the error message is really for client reading then their brower
already is aware of its own IP address and should be able to display
that with javascript/Jscript. All modern browsers have that capability.

If the error details is for your internal use and not the client, then
sending the IP in the body of an error page is the wrong thing to do. A
custom header would be better for most uses. X-Client-IP is used already
by some software.


More information about the squid-users mailing list