Forum Moderators: phranque

Message Too Old, No Replies

Rewrite the URL examining the IP address

         

purujit

8:29 am on Jul 31, 2006 (gmt 0)

10+ Year Member



Hello,
I am a new user in this Forum. Please Help me.

I am using Apache Resin and my Java Application is running on Resin.

I`ve a list of IP addresses in this format :
89.15.0.0/12
89.16.0.0/15
[...]

What I want to do is to use apache to rewrite the URL examining the IP address of those range and then appending a URL name / value pair (user=user)to the URL being delivered to the Java-based rendering application.
How can this be done.

Thanks!

jdMorgan

1:08 pm on Jul 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mod_rewrite does not support the Network/CIDR format for IP addresses, and does not have the functionality needed to do user-account lookups directly.

Therefore, the simplest solution is to rewrite all applicable requests to a script which can then do the IP conversion/range-matching, look up the user by IP address, and then 'include' or redirect to the correct URL with an appropriate "user=" query string appended.

A major concern for this approach is corporate networks and ISPs like AOL, which use caching proxies, thereby obscuring the actual 'user' IP address. In some cases, one user will appear to have multiple IP addresses, and in other cases, multiple users will appear to share a single IP address. Therefore, it will be impossible to be sure of the user account associated with a particular IP address in these ranges; Your script and site design will need to take that into account -- perhaps by requiring direct username-based logins for those IP address ranges.

Jim

purujit

5:33 am on Aug 2, 2006 (gmt 0)

10+ Year Member



Thanks jdMorgan.

I think in my last mail i faild to make it clear.

First of all i am new to Apache. And i am preparing an LLD of an application.The application will be web based J2EE Appl.
I need to use Resin with Apache.

The landing page(JSP) will vary depending on the users.And i have to customise the landing pages for some specific users(from specific IP Address).
I just want that my Apache server to identify those specific users based on the IPAddress & then append a query string with the URL which will be forwarded to Resin server.In the Resin server the Java Application will identify the users based on the query String.

My query was Can apache do that if yes then please give some hints.

Thanks again to the Gruop Members.

PS