- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- URL Redirection based on IP Address
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2003 10:20 PM
08-06-2003 10:20 PM
URL Redirection based on IP Address
We need to find a way to REDIRECT http requests to "apps.msvr.mu" to "apps2.msvr.mu" based on the IP address of the client browser.
In our setup, we have two sites (LAN1, LAN2) running over a WAN. We have 2 DNSes - one at each site.
On LAN1 and LAN2, our client browsers currently have default home page set to "apps.msvr.mu". "apps2.msvr.mu" is our new server.
We want our future setup as follows:
LAN1 => "apps.msvr.mu"
LAN2 => "apps2.msvr.mu"
We want to load balance with the least modification on the client side.
FYI: we have been able to "redirect" all the requests from apps.msvr.mu to apps2.msvr.mu but could not do the load sharing based on IP address of client.
[using ProxyPass / http://apps2.msvr.mu/ ]
Any solution at the apache level?
Any solution at the DNS level?
Thank you in advance for your replies!
best regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2003 10:38 PM
08-06-2003 10:38 PM
Re: URL Redirection based on IP Address
Need to clarify your question
<
By what I understand you can redirect the page by at apache level
There are two techniques to implement canonical hostnames:
Use mod_rewrite as described in the "Canonical Hostnames" section of the URL Rewriting Guide.
Use name-based virtual hosting:
NameVirtualHost *
ServerName www.example.net
ServerAlias example.com
Redirect permanent / http://www.example.com/
ServerName www.example.com
DocumentRoot /usr/local/apache/htdocs
On the DNS side maybe you can set that LAN2 user DNS will be pointing to your new server staight and do a redirect page in the server.
This is what I understand from your question
Please reply to this
Thanks & Regards
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2003 10:41 PM
08-06-2003 10:41 PM
Re: URL Redirection based on IP Address
You need to have to master DNS servers, one for each lan, with slightly different records.
I'll try and use your example.
DNS is normally auto-assigned to microsoft clients so you do the following on the client side:
LAN1
DNS Primary is dns.apps.msvr.mu
DNS Secondarry is dns.apps2.msver.mu
LAN2
DNS Primary is dns.apps2.msvr.mu
DNS Secondarry is dns.apps.msver.mu
If one DNS server is down there is failover. You don't need very much bandwidth to handle the DNS requests. The httpd traffic shouldn't be too much of a strain. The Oracle data, thats hard to tell.
LAN1 => "apps.msvr.mu"
LAN2 => "apps2.msvr.mu"
LAN1 's DNS server
has a zone for apps.msvr.mu which resolves locally and a zone for apps2.msvr.mu that resolves to IP addresses on the apps2 side of the house.
LAN2 has the zone records reversed of LAN1
That accomplishes your goal purely with DNS.
You might look into named or IP based virtual hosting directives on the apache side to provide further redundancy or load balancing.
http://httpd.apache.org/docs-2.0/vhosts/name-based.html
http://httpd.apache.org/docs-2.0/vhosts/ip-based.html
With the same general concept, you can probably accomplish the same thing we did above with dns in httpd.conf
Again, based on your example.
A directive in httpd.conf on the LAN1 side.
Lets say apps resolves to 192.168.143.198
Lets say apps resolves to 192.168.144.198
ServerAdmin you@yourdomain.com
DocumentRoot /home/webusers/apps/htdocs
ServerName apps.msvr.mu:80
ScriptAlias /cgi-bin/ "/home/webusers/apps/cgi-bin/"
ErrorLog logs/apps.error_log
CustomLog logs/apps.com.access_log common
ServerAdmin you@yourdomain.com
DocumentRoot /home/webusers/apps2/htdocs
ServerName apps2.msvr.mu:80
ScriptAlias /cgi-bin/ "/home/webusers/apps2/cgi-bin/"
ErrorLog logs/apps2.error_log
CustomLog logs/apps.2com.access_log common
Have the same directives in httpd.conf on the LAN2 side and you can with a little tweaking load balance quite nicely.
It doesn't matter what the client IP address is, it matters what its DNS or httpd server tells the client to do.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2003 06:04 AM
08-07-2003 06:04 AM
Re: URL Redirection based on IP Address
thank you both for your replies.
I have not yet tested the solutions you have provided.
In the scenario i presented in my question, i mentioned about 2 LANs but in fact i have 4!
I already have the DNS setup as SEP outlined above. The problem is:
-----Primary DNS-----------Secondary DNS
LAN1: dns.apps2.mysvr.mu<->dns.apps1.mysvr.mu
LAN2: dns.apps2.mysvr.mu<->dns.apps1.mysvr.mu
LAN3: dns.apps1.mysvr.mu<->dns.apps2.mysvr.mu
LAN4: dns.apps1.mysvr.mu<->dns.apps2.mysvr.mu
I don't want the DNS changes to affect clients on LAN2... :(
any more ideas?
best regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2003 03:57 AM
08-11-2003 03:57 AM
Re: URL Redirection based on IP Address
You can do what you want in this way. First you must set an evironment variable for each destination server using the value of the client ip(http://httpd.apache.org/docs/mod/mod_setenvif.html, setenvif directive). After that you can use mod_rewrite(http://httpd.apache.org/docs/mod/mod_rewrite.html#RewriteCond). The first part isn??t necessary but I think it would be better to define a range of ip addresses associated to a variable and then use this variable to make the redirection.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2003 06:38 AM
08-11-2003 06:38 AM
Re: URL Redirection based on IP Address
Ron