Proxy using Sun ONE Reverse Proxy plugin
I have a web application hosted as http://www.domain-a.com. I am trying to setup reverse proxy for a site (say http://www.domain-b.com), so that when the user hits the URL http://www.domain-a.com/domain-b using his web browser, the web server proxies the request to the site http://www.domain-b.com, and then return response to the user as if the response was generated from http://www.domain-a.com. Further, any links & resources on the page should also appear as if originating from http://www.domain-a.com.
Platform:
Web Server: Sun ONE Web Server 6.1SP6 with Sun ONE Web Server 6.1SP3 Reverse Proxy Plug-in
OS: Windows XP Professional
Achieved so far:
I configured the reverse proxy plug-in as given below to make it work:
magnus.conf, to add the plug-in (lines added/modified as blue):
#
# The NetsiteRoot, ServerName, and ServerID directives are DEPRECATED.
# They will not be supported in future releases of the Web Server.
NetsiteRoot C:/Sun/WebServer6.1
ServerName dcsprintloaner1.sapient.com
ServerID https-dcsprintloaner1.sapient.com
#
RqThrottle 128
DNS off
Security off
ExtraPath C:/Sun/WebServer6.1/bin/https/bin
Init fn=flex-init access="$accesslog" format.access="%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%] \"%Req->reqpb.clf-request%\" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length%"
Init fn="load-modules" shlib="C:/Sun/WebServer6.1/bin/https/bin/j2eeplugin.dll" shlib_flags="(global|now)"
Init fn="load-modules" shlib="C:/Sun/WebServer6.1/plugins/nsapi/passthrough/passthrough.dll"
Init fn="stats-init" profiling="on"
obj.conf, to achieve reverse proxy (lines added/modified as blue):
# You can editthis file, but comments and formatting changes
# might be lost when the admin server makes changes.
# Use only forward slashes in pathnames--backslashes can cause
# problems. See the documentationfor more information.
<Object name="default">
AuthTrans fn="match-browser" browser="*MSIE*" ssl-unclean-shutdown="true"
NameTrans fn="ntrans-j2ee" name="j2ee"
NameTrans fn="pfx2dir" from="/mc-icons" dir="C:/Sun/WebServer6.1/ns-icons" name="es-internal"
NameTrans fn="assign-name" from="/domain-b" name="proxy-request1"
NameTrans fn="document-root" root="$docroot"
PathCheck fn="nt-uri-clean"
PathCheck fn="check-acl" acl="default"
PathCheck fn="find-pathinfo"
PathCheck fn="find-index" index-names="index.html,home.html,index.jsp"
ObjectType fn="type-by-extension"
ObjectType fn="force-type" type="text/plain"
Service method="(GET|HEAD)" type="magnus-internal/imagemap" fn="imagemap"
Service method="(GET|HEAD)" type="magnus-internal/directory" fn="index-common"
Service method="(GET|HEAD|POST)" type="*~magnus-internal/*" fn="send-file"
Service method="TRACE" fn="service-trace"
Service method="(GET|HEAD)" type="*/*" fn="service-passthrough" servers="http://www.domain-b.com"
Error fn="error-j2ee"
AddLog fn="flex-log" name="access"
</Object>
<Object name="j2ee">
Service fn="service-j2ee" method="*"
</Object>
<Object name="cgi">
ObjectType fn="force-type" type="magnus-internal/cgi"
Service fn="send-cgi"
</Object>
<Object name="es-internal">
PathCheck fn="check-acl" acl="es-internal"
</Object>
<Object name="send-compressed">
PathCheck fn="find-compressed"
</Object>
<Object name="compress-on-demand">
Output fn="insert-filter" filter="http-compression"
</Object>
<Object name="proxy-request1">
Service type=magnus-internal/passthrough fn=service-passthrough servers="http://www.domain-b.com"
</object>
However, the end user could only see a 404 error (Page not found) when hitting the URL http://www.domain-a.com/domain-b. Following is the error from error log:
[09/Jan/2007:13:49:09] info ( 2596): CORE3274: successful server startup
[09/Jan/2007:13:49:31] warning ( 2596): for host 127.0.0.1 trying to GET /domain-b, send-file reports: HTTP4142: can't find C:/Sun/WebServer6.1/docs/domain-b (File not found)
I went through through some of the posting in this forums,and tried to replicate the suggestions at my end. However, I was not able to achieve the same. Please see if my approach is correct, and there is no issue with the configurations.
Thnx,
Amit

