Project

General

Profile

Actions

Feature #151

closed

mod_proxy should log requests...

Added by Anonymous almost 20 years ago. Updated over 16 years ago.

Status:
Invalid
Priority:
Low
Category:
mod_proxy
Target version:
-
ASK QUESTIONS IN Forums:

Description

All requests that go through mod_proxy lose the IP address of the user.

A handy feature would be for mod_proxy to log every request to the accesslog. Then, when I run my log analyzer, it won't look like a million hits from 127.0.0.1. :)

-- chris

Actions #1

Updated by Anonymous over 19 years ago

Really? How does that work? I didn't realize it was possible to tell an HTTP server what your IP address is, aside from the src IP in the TCP/IP packets. That sounds like it would be a bit of a security risk if users could spoof their IPs like that. :)

-- chris

Actions #2

Updated by Anonymous over 19 years ago

That is not the job of mod_proxy. The real IP address of the user is forwarded in the header X-Forwarded-For, so you can just modify the logfile format a bit to use "%{X-Forwarded-For}i" instead of "%h".

My accesslog.format looks like this behind a lighttpd proxy:
accesslog.format = "%{X-Forwarded-For}i l %u %t \"%r\" %>s %b \"{Referer}i\" \"%{User-Agent}i\""

-- roger-wilco

Actions #3

Updated by Anonymous over 19 years ago

I can think of a couple reasons why you'd want the mod_proxy module to log things.

First, if you were running lighttpd's mod_proxy as a load balancer for a cluster, you might want to have that one machine log all requests so that you can run a log analyzer on a single logfile. Otherwise, you'd have to collect logfiles from all of the servers and then weave them together based on timestamp.

Another reason is if you're running a web-application that uses a minimalistic webserver which doesn't have the option of putting X-Forwarded-For in the logfiles (for example, CherryPy's embedded server). I'm not sure if WEBrick or Twisted.web or medusa have the same problem, but even if they do, it's a convenience issue -- it's much nicer to just set "proxy.log_requests = true" in your lighttpd config rather than tooling around, trying to figure out how to make some random webapp use special log headers.

-- chris

Actions #4

Updated by stbuehler over 16 years ago

  • Status changed from New to Fixed
  • Resolution set to invalid

I don't see your problem... all requests get logged with mod_accesslog?

Actions #5

Updated by stbuehler over 16 years ago

  • Status changed from Fixed to Invalid
Actions

Also available in: Atom