Design User IP Condition w/ Squid

I have always had our Google Analytics set up so that I can track on-campus visits and off-campus visits. This is because most on-campus computers set our website to their startup page, so I wanted to filter those out as not "real" visits.


Recently we had Squid installed, and I am now realizing since Squid is in front of our webserver, Matrix will always see ALL requests from an on campus IP address, so my User IP Condition no longer works, meaning I am no longer tracking on campus users.



Here was my previous setup:


    The user's IP address matches the following pattern
    Network IP Address		Subnet Mask	Action
    10.0.0.0	 /	 255.0.0.0	Grant	  
    192.168.0.0	 /	 255.255.0.0	Grant	  
    If IP address is outside one of these ranges: Deny


Is there any other way I can do this with Squid in place? Is there another I can check if a user is accessing our website locally or not, even with Squid?

<deleted for reasons of dumbness> :slight_smile:

[quote]
I have always had our Google Analytics set up so that I can track on-campus visits and off-campus visits. This is because most on-campus computers set our website to their startup page, so I wanted to filter those out as not "real" visits.



Recently we had Squid installed, and I am now realizing since Squid is in front of our webserver, Matrix will always see ALL requests from an on campus IP address, so my User IP Condition no longer works, meaning I am no longer tracking on campus users.



Here was my previous setup:


    The user's IP address matches the following pattern
    Network IP Address		Subnet Mask	Action
    10.0.0.0	 /	 255.0.0.0	Grant	  
    192.168.0.0	 /	 255.255.0.0	Grant	  
    If IP address is outside one of these ranges: Deny


Is there any other way I can do this with Squid in place? Is there another I can check if a user is accessing our website locally or not, even with Squid?
[/quote]

Sorry man, from what I can see, it looks like the condition user ip only checks REMOTE_ADDR, you would need to check the X-FORWARDED-FOR server variable. If you feel confident to modify the condition, you might be able to change it. Hope that helps

Matrix can use X-Forward-For to replace REMOTE_ADDRESS.


See Feature #4260:

X Forwarded For handling for IP authentication. Two system configuration settings added. One to enable/disable use of HTTP_X_FORWARDED_FOR as opposed to default use of REMOTE_ADDR. The other setting is a list of trusted/known proxies to reduce risk of using a fudged header. User IP change is processed in every initialisation of matrix (mysource.inc).

[quote]
Sorry man, from what I can see, it looks like the condition user ip only checks REMOTE_ADDR, you would need to check the X-FORWARDED-FOR server variable. If you feel confident to modify the condition, you might be able to change it. Hope that helps

[/quote]



Hmm, so then I would have to write a regex to check if that IP was within my range?

[quote]
Hmm, so then I would have to write a regex to check if that IP was within my range?

[/quote]



Possibly yes, or use the feature Edison mentioned.

[quote]
Matrix can use X-Forward-For to replace REMOTE_ADDRESS.



See Feature #4260:

X Forwarded For handling for IP authentication. Two system configuration settings added. One to enable/disable use of HTTP_X_FORWARDED_FOR as opposed to default use of REMOTE_ADDR. The other setting is a list of trusted/known proxies to reduce risk of using a fudged header. User IP change is processed in every initialisation of matrix (mysource.inc).

[/quote]



Ok, we upgraded to 4.4.1 and now have the X-Forwarded-For feature. It is asking for the ip address of our webserver or something else?