4

Some months ago I was working with Squid 3.0 and managed to get rid of the X-Forwarded-For header completely. Now I am trying to do the same thing but I do not seem to hit the nail.

I have tried forwarded_for off but that does not remove the header, it just inserts unknown in place of the client IP.

I tried header_access X-Forwarded-For deny all but I receive an error about invalid directive. Looking in the function reference it seems that this directive is deprecated in 3.0.

I tried forwarded_for delete but this is only available from 3.1.

Any suggestions?

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
mr-euro
  • 848
  • 3
  • 14
  • 31

4 Answers4

10

Here's the full list you need:-

via off
forwarded_for off
follow_x_forwarded_for deny all
request_header_access X-Forwarded-For deny all
header_access X_Forwarded_For deny all
cnd
  • 230
  • 2
  • 6
6

Fixed with:

request_header_access X-Forwarded-For deny all
mr-euro
  • 848
  • 3
  • 14
  • 31
1

For specific domains you can use

acl NoXForwardedFor dst "/usr/pbi/squid-amd64/etc/squid/NoXForwardedFor.txt"

request_header_access X-Forwarded-For deny NoXForwardedFor

where NoXForwarded.txt contains domain names.

Felix Frank
  • 3,093
  • 1
  • 16
  • 22
user226166
  • 11
  • 2
1

you can set forwarded_for directive to truncate

forwarded_for truncate

this will remove all existing X-Forwarded-For entries, and place the client IP as the sole entry

For more about this directive visit squid : forwarded_for configuration directive