Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Bugs

#1329: Option to respect X-Forwarded-For header in varnishncsa

 

 

Varnish bugs RSS feed   Index | Next | Previous | View Threaded


varnish-bugs at varnish-cache

Jul 18, 2013, 6:30 AM

Post #1 of 4 (52 views)
Permalink
#1329: Option to respect X-Forwarded-For header in varnishncsa

#1329: Option to respect X-Forwarded-For header in varnishncsa
----------------------+-------------------------
Reporter: mhelmich | Type: enhancement
Status: new | Priority: normal
Milestone: | Component: varnishncsa
Version: 3.0.4 | Severity: minor
Keywords: |
----------------------+-------------------------
While varnishncsa offers a "-f" flag in order to respect a X-Forwarded-For
request header, this flag implies a fixed log line format and cannot be
used in conjunction with "-F".

The attached commit changes the "-f" behaviour causing varnishncsa to use
the value from the X-Forwarded-For header (if present) instead of the
client IP while allowing a custom log format at the same time. No change
to the log line format is required anymore, the forwarded address will be
inserted into the %h placeholder.

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1329>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs


varnish-bugs at varnish-cache

Jul 22, 2013, 3:27 AM

Post #2 of 4 (45 views)
Permalink
Re: #1329: Option to respect X-Forwarded-For header in varnishncsa [In reply to]

#1329: Option to respect X-Forwarded-For header in varnishncsa
-------------------------+--------------------
Reporter: mhelmich | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: varnishncsa | Version: 3.0.4
Severity: minor | Resolution:
Keywords: |
-------------------------+--------------------

Comment (by tfheen):

I would be more inclined towards removing the -f switch completely, since
it's redundant now we have the -F switch.

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1329#comment:1>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs


varnish-bugs at varnish-cache

Jul 22, 2013, 5:24 AM

Post #3 of 4 (45 views)
Permalink
Re: #1329: Option to respect X-Forwarded-For header in varnishncsa [In reply to]

#1329: Option to respect X-Forwarded-For header in varnishncsa
-------------------------+--------------------
Reporter: mhelmich | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: varnishncsa | Version: 3.0.4
Severity: minor | Resolution:
Keywords: |
-------------------------+--------------------

Comment (by mhelmich):

For us the "-f" switch (with the patched behaviour) has proven itself
quite useful. In our case, we handle both requests with and without X
-Forwarded-For header (and currently I don't see how to handle this with
the -F switch alone).

Some more background on this:[[BR]]
We operate varnish behind a loadbalancing system that operates on an
IPv4/IPv6 dual-stack. The internal network is IPv4-only. For native IPv4
requests, the client IP contains the actual IP address; for translated
IPv6 request however, varnish sees only the IPv4 address of our
loadbalancing system (which -- in this case -- sets the X-Forwarded-For
header with the forwarded IPv6 address).

One possible (and more general) use case might be, when you are running
varnish behind another reverse proxy as SSL terminator. When you have
varnish listening on port 80, and an nginx on port 443, you will probably
also have both request with and without an X-Forwarded-For header.

This allows us to just use the "%h" parameter in the log line format and
to have it replaced with the X-Forwarded-For header if present, or the
actual client ip otherwise.

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1329#comment:2>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs


varnish-bugs at varnish-cache

Aug 5, 2013, 3:25 AM

Post #4 of 4 (12 views)
Permalink
Re: #1329: Option to respect X-Forwarded-For header in varnishncsa [In reply to]

#1329: Option to respect X-Forwarded-For header in varnishncsa
-------------------------+--------------------
Reporter: mhelmich | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: varnishncsa | Version: 3.0.4
Severity: minor | Resolution:
Keywords: |
-------------------------+--------------------

Comment (by tfheen):

You can do this with the -F switch alone if you just log what you want in
VCL (std.log("IP:"+client.ip) and then use %{VCL_Log:IP} in your format
string.

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1329#comment:3>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs

Varnish bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.