| Previous · Next | |
| User | Message |
|
bernd
|
Date: 7/6/2008 3:50 am · Subject: IPs of interfaces apache binds to · Rating: -1
How can I query IPs of interfaces apache binds to? I need this to distinguish between internal and external requests in the userSession table.
-- |
| Back to Top |
Rate [ | ]
|
|
knowmad
|
Date: 7/6/2008 8:59 pm · Subject: Re: IPs of interfaces apache binds to · Rating: 1
Can you explain more about what you're trying to do? Are you trying to find this info from a macro? a custom wobject? Generally, you can query the referer string to find where the request is coming from. For mod_perl, try $r->headers_in('Referer') (see perl.apache.org for more, code not tested). I'm not sure how you're going to know if the request is internal or external without some kind of lookup table or a regex (depending on how big your internal network is).
William ---- |
| Back to Top |
Rate [ | ]
|
|
bernd
|
Date: 7/7/2008 2:42 pm · Subject: Re: IPs of interfaces apache binds to · Rating: -1
Hi William, I am trying to improve the UsersOnline macro. In one place, the number of visitors is determined by the following query: SELECT COUNT(DISTINCT lastIp) FROM userSession where (lastPageView >= $epoch) and (userId = 1) However, I noticed that the number of visitors is increased artificially by internal requests. I assume this is due to mod_proxy accessing mod_perl or maybe due to spectre. Anyway, I would like to filter out ips belonging to the loopback device and ips apache binds to. That should solve the problem. Any idea? Bernd -- |
| Back to Top |
Rate [ | ]
|
|
JT
|
Date: 7/7/2008 7:35 pm · Subject: Re: IPs of interfaces apache binds to · Rating: 0
Are you saying that you don't already know what your internal IP ranges are? $session->server gives you a reference to Apache2::ServerUtil, which can probably give you those IPs. > How can I query IPs of interfaces apache binds to? I need this to > distinguish between internal and external requests in the > userSession table. > JT Smith ph: 703-286-2525 x810 fx: 312-264-5382 Create like a god. Command like a king. Work like a slave. |
| Back to Top |
Rate [ | ]
|
|
dionak
|
Date: 7/7/2008 8:30 pm · Subject: Re: IPs of interfaces apache binds to · Rating: 0
To add to JT's comment, you could probably filter request by using aregex on the IP, filtering out your interal IP's. dionak On Mon, Jul 7, 2008 at 8:36 PM, wrote: > JT wrote: > > Are you saying that you don't already know what your internal IP > ranges are? > > $session->server gives you a reference to Apache2::ServerUtil, which > can probably give you those IPs. > >> How can I query IPs of interfaces apache binds to? I need this to >> distinguish between internal and external requests in the >> userSession table. >> > > > > > JT Smith > ph: 703-286-2525 x810 > fx: 312-264-5382 > > Create like a god. Command like a king. Work like a slave. > > > > http://www.plainblack.com/webgui/dev/discuss/ips-of-interfaces-apache-binds-to/3 > > > -- > > > > Plain Black, makers of WebGUI > > http://plainblack.com > > > -- Knowmad Technologies - Open Source Software Solutions W: http://www.knowmad.com | E: diona@knowmad.com P: 704.343.9330 | http://www.LinkedIn.com/in/dionakidd |
| Back to Top |
Rate [ | ]
|
|
apeiron
|
Date: 7/8/2008 10:35 am · Subject: Re: IPs of interfaces apache binds to · Rating: 0
On Jul 7, 2008, at 20:30 :35, wrote: > dionak wrote: > > To add to JT's comment, you could probably filter request by using a > regex on the IP, filtering out your interal IP's. I would probably go with http://search.cpan.org/~frajulac/Net-IPv4Addr-0.10/IPv4Addr.pm to keep things simple and maintainable. Yes, it's an encapsulation of some regexes (although it uses unpack in several places), but it's a *readable* encapsulation. :) Chris Nehren // Plain Black p 1.703.286.2525 x 811 m 1.267.573.1000 f 1.312.264.5382 |
| Back to Top |
Rate [ | ]
|
|
bernd
|
Date: 7/27/2008 6:46 am · Subject: Re: IPs of interfaces apache binds to · Rating: -1
$session->server returns an object of type Apache2::ServerRec, in fact. The documentation of this field is incorrect and should be updated If someone was interested, the following code is what I had been looking for: # Query server hostname $ip_clause can now be added to SQL queries in order to filter out server ips. |
| Back to Top |
Rate [ | ]
|