URL Rewriting again..

Hello..

There are a number of threads on URL forwarding in this forum; and it seems all of them are about rewriting the URL where webinstance is different.

We have a unique situation in URL rewriting.. the scenario is

There is a loadbalancer at myserver.org and it distributes load to two sun one 6.0 webservers running on Solaris OS.

webserver1:8080

webserver2:8080

We have added a virtual ip to the load balancer and it resolves as

myserver.com

now all the requests landing at myserver.org should get redirected to myserver.com and has to go to the above webservers. So only the URL display changes, webserver instances remain the same!!

Eg, myserver.org/docs/applisting --> myserver.com/docs/applisting

The network guys are unable to do this rewriting in load balancer level and I am left with the option to change webserver configuration.

Thougt of doing a NameTrans but it results in a loop as the requests are landing back to same web instances.

fn NameTrans="redirect" from="/" url-prefix="http://myserver.com"

Any inputs on how to implement this is appreciated

Thanks ...

[1173 byte] By [joe-a] at [2007-11-27 9:56:29]
# 1

In Web Server 7.0, you can set a canonical server name. Any accesses using other server names will be automatically redirected to the canonical server name. In your case, you want the canonical server name to be myserver.com. You can configure this a) using the wadm set-virtual-server-prop command to set the canonical-server-name property to myserver.com or b) by adding the following to the <virtual-server> element in server.xml:

<canonical-server-name>myserver.com</canonical-server-name>

If you're not using 7.0, you can use the following in earlier versions' obj.conf configuration file:<Client urlhost="*~myserver.com">

NameTrans fn="redirect" from="/" url-prefix="http://myserver.com/"

</Client>The above lines should be added immediately below the <Object name="default"> line.

Message was edited by:

elving

elvinga at 2007-7-13 0:26:35 > top of Java-index,Web & Directory Servers,Web Servers...
# 2
Thanks for the message.We are not using Webserver 7.0; instead still at 6.0SP5Thanks it is working.Message was edited by: joe-
joe-a at 2007-7-13 0:26:36 > top of Java-index,Web & Directory Servers,Web Servers...
# 3

The URL rewriting works fine.. but it disturbs the document root.

When the above code is placed, then the document root gets changed to the Unix root file system!

Any suggestion how to fix this ?..

document root is defined in server.xml as

VARS docroot="/opt/SunOne/docs" user="" group="" chroot="" dir="" nice=

""/>

and it is referenced in obj,conf as

NameTrans fn=document-root root="$docroot"

The document root works fine when the URL rewriting code is disabled.

joe-a at 2007-7-13 0:26:36 > top of Java-index,Web & Directory Servers,Web Servers...
# 4

It works on Sun ONE Web Server 6.1 and Sun Java System Web Server 7.0 without affecting the document root, and I don't have a 6.0 installation to play with. (iPlanet Web Server 6.0 is really old. I think you should consider upgrading to a supported version like Sun Java System Web Server 7.0.)

It's possible that the specifying internal="false" could fix the problem:<Client urlhost="*~myserver.com" internal="false">

NameTrans fn="redirect" from="/" url-prefix="http://myserver.com/"

</Client>I haven't checked, though.

elvinga at 2007-7-13 0:26:36 > top of Java-index,Web & Directory Servers,Web Servers...
# 5
Kool. This works. Thx.I have checked the NSAPI document / this forum for "internal" directive. could not get any description.Can you pls explain what this does ? Will it have any other impacts ?Thx
joe-a at 2007-7-13 0:26:36 > top of Java-index,Web & Directory Servers,Web Servers...
# 6
<Client internal="false"> tells the server to executive a directive only for HTTP requests, not for internal requests. Internal requests could be SHTML includes, URI-to-path translation requests, etc.
elvinga at 2007-7-13 0:26:36 > top of Java-index,Web & Directory Servers,Web Servers...