-1

i have my url running on https://domain.com:7002/app1, i want to make a weblogic redirect when ever users type domain.com in the browser, it should place them to https://domain.com:7002/app1

what changes are required from the Weblogic side to make the redirect work?

Thanks

3 Answers 3

1

There are some things you can do on your web.xml, but I'm not sure if that kind of redirect must be done by Weblogic. Instead of that, you can use some other way to redirect: I've done something similar to what you need using nginx and haproxy.

Using nginx you can do something like

location / {
proxy_pass https://domain.com:7002/app1;
}
0

Weblogic comes with OHS (Oracle HTTP Server) which is basically Apache. Here's a blog post about using Apache with a weblogic cluster, but it does show you how to redirect to a single server too.

The relevant part is this (modified for your example):

<Location / >
   SetHandler weblogic-handler
   WebLogicHost https://domain.com
   WebLogicPort 7002
   PathPrepend app1
</Location>

The "Location /" tag tells your server that whenever the root context is accessed, the block should be invoked. mod_wl will then redirect you to the supplied host and port and the "PathPrepend" will add "app1" immediately following the port.

For more details, see the documentation.

0

you can use weblogic proxy class "weblogic.servlet.proxy.HttpProxyServlet". To set up a proxy you need create web.xml and weblogic.xml, and put them in WEB-INF directory as a proxy project. example for weblogic.xml

    <!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 9.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">
  <weblogic-web-app>
    <context-root>/</context-root>
  </weblogic-web-app>
**example for web.xml** 


    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";> 

<web-app>
   <servlet>
     <servlet-name>ProxyServlet</servlet-name>
     <servlet-class>weblogic.servlet.proxy.HttpProxyServlet</servlet-class>
     <init-param>
     <param-name>redirectURL</param-name>
     <param-value> https://domain.com:7002</param-value>
     </init-param>
     <!-- init-param>
     <param-name>PathTrim</param-name>
     <param-value>/proxy</param-value>
     </init-param-->
     <init-param>
     <param-name>PathPrepend</param-name>
     <param-value>/app1</param-value>
     </init-param>
  </servlet>
  <servlet-mapping>
     <servlet-name>ProxyServlet</servlet-name>
     <url-pattern>/</url-pattern>
 </servlet-mapping>
</web-app>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .