#490 {+add-header{X-Forwarded-For: Client-IP}}

version 3.0
closed-fixed
Fabian Keil
5
2014-03-06
2008-09-11
Anonymous
No

Dear,

I'm setting up Privoxy version 3.0.8 like a URL-Filtering in intercept proxy mode. But the feature needed is to provide real client ip address to server.

Could you please give me sample for doing this?

Should it done by CLIENT-HEADER-TAGGER & {+add-header{X-Forwarded-For: XXX}}. But I don't know how is arguement attern.

I already tried version 3.0.6 it's OK in providing server the real client ip address but it's not support intercept proxy mode.

Thank you in advance.

Cheers,
Sanan K.

Discussion

  • Fabian Keil
    Fabian Keil
    2008-09-12

    There currently is no clean way to add a
    X-Forwarded-For header, so it looks like
    we need a add-x-forwarded-for-header action.

    As a workaround you could add the following
    client-header filter to one of your filter
    files:

    CLIENT-HEADER-FILTER: x-forwarded-for-workaround Replaces any Connection header with an "X-Forwarded-For:" header.
    s@^Connection:.*$@X-Forwarded-For: $origin@iD
    (The description should be one line, SF may split it in two.)

    And add the following section to one of your action
    files:

    {+client-header-filter{x-forwarded-for-workaround}\ +add-header{Connection: close}\ }
    /

     
  • Fabian Keil
    Fabian Keil
    2008-09-12

    • assigned_to: nobody --> fabiankeil
    • status: open --> pending
     
  • fabiankeil,

    Thank so much for your prompt response. I will try.

    Cheers,
    Sanan K.

     
    • status: pending --> open
     
  • Dear fabiankeil,

    I already done as your sugesstion. But changing transform field "Accept: " instead of "Connection: " client header.

    Thanks a lot,
    Sanan K.

     
  • Fabian Keil
    Fabian Keil
    2008-09-21

    • status: open --> closed-fixed
     
  • Fabian Keil
    Fabian Keil
    2008-09-21

    You're welcome.

    In future versions you will be able
    to achieve the same with:

    {+change-x-forwarded-for{add}}
    /

     
  • Van Tien Vo
    Van Tien Vo
    2014-02-24

    Thank @Fabian Keil for $origin to get IP of client.
    Now i want get Physical Address of client (MAC Address) in filter.
    Please help me.

    Thank You.

     
  • Fabian Keil
    Fabian Keil
    2014-02-24

    At the moment Privoxy has no knowledge about the client's MAC address and I'm not aware of a portable way to get it.

    Thus my gut feeling is that adding a $mac variable would take a lot of work (to support all platforms) for comparatively little gain.

    Could you describe why you need it? Maybe there's another solution.

     
  • Van Tien Vo
    Van Tien Vo
    2014-02-25

    I do application to track staff in my customer company.
    Through which HRM can evaluate the productivity of their labor
    Because the network uses DHCP, so I want to get the MAC client.

    In the privoxy filter I want to insert a trace script, for example:
    [script src="http://192.168.1.2/tracking.js?mac=xx-xx-xx-xx-xx\" /]

    Can you give me a better solution?

    Thank you.

     
    Last edit: Van Tien Vo 2014-02-25
  • Fabian Keil
    Fabian Keil
    2014-03-03

    Privoxy is (supposed to be) a privacy-enhancing proxy, therefore that's not a particularly convincing use case to implement $mac support ...

    As a workaround in other scenarios I'd recommend configuring the DHCP server to bind IP addresses to the MAC addresses so recording the IP addresses is sufficient.

     
  • Van Tien Vo
    Van Tien Vo
    2014-03-06

    Thank You very much

     
    Last edit: Van Tien Vo 2014-03-06