Webservers Archive

Configure IIS7 as a proxy with weblogic server.

To configure the WLS proxy, first thing to do is to place the iisproxy.dll, iisforward.dll and iisproxy.ini in the root folder of the website.

 

In this example, I use the Default Website that is installed with IIS. So the above files are copied into its root directory, which is C:\Inetpub\wwwroot\ >  (NOTE, for a smooth working of the configuration, always copy the iisforward.dll and iisproxy.dll into the root directory of the WebSite. Otherwise, loading module, iisforward.dll will fail due to permission issues)

 

The iisproxy.ini has the following parameters:

 

WebLogicHost=<dns name or ip addgress>

WebLogicPort=<litening port for WLS>

WlForwardPath=/examplesWebApp

 

WlForward is the web application you want to proxy to in this example, If all web applications are to proxy to WebLogic Server just use WlForwardPath=/

 

Debug=ALL

Optional and used to collect debug information.  It is logged by default in c:\TEMP\wlproxy.log

DebugConfigInfo=ON

 

DebugConfigInfo is also is only used for debugging, the default is OFF.

Also note the WebLogicCluster=myweblogic.com:7001,yourweblogic.com:7001 line if you are using clusters.  This replaces the WebLogicHost and WeLogicPort entries.

 

(See  http://docs.oracle.com/cd/E23943_01/web.1111/e14395/plugin_params.htm for complete parameter list)

 

So just to get started all that needs to be in the issproxy.ini is the following when proxying is done by the Web Application name, if proxying exclusively by mime type (e.g.; .jsp) WlForwardPath does not need to be specified in the iisproxy.ini

 

NOTE: This is case sensitive

 

WebLogicHost=<dns name or ip address>

WebLogicPort=<listening port for WLS>

WlForwardPath=/examplesWebApp

 

 

This is a sample output from the directory/folder that the iisproxy.dll, iisforward.dll and iisproxy.ini is placed

 

Directory of C:\inetpub\wwwroot

 

10/02/2012  12:03 AM    <DIR>          .

10/02/2012  12:03 AM    <DIR>          ..

10/02/2012  12:06 AM           20,480 iisforward.dll

10/02/2012  12:06 AM          626,176 iisproxy.dll

10/02/2012  12:06 AM               182 iisproxy.ini

10/02/2012  12:09 AM               689 iisstart.htm

10/02/2012  12:09 AM               168 web.config

10/02/2012  12:09 AM           184,946 welcome.png

6 File(s)        832,641 bytes

2 Dir(s)  15,052,578,816 bytes free

And here is how it looks from IIS 7.0 (Default Web Site à content View)

Note: I am using the Default Web Site in this example.

 

If you do not have IIS 7.0 installed in your Windows Server 2008, follow the instructions in the below link to install IIS7.0

http://learn.iis.net/page.aspx/29/installing-iis7-on-windows-server-2008/

Now configure IIS 7.0

Before you configure IIS 7.0, make sure IIS 7.0 is installed with ISAPI Filters and ISAPI Extensions. If installed then Default Web Site à Features View should look like below:

 

 

 

 

 

If you do not see the ISAPI Filter icon in the Feature View, go to “Server Manager”, in thee left pane under Roles, click on Web Server (IIS)

Then click on “Add Role Services” on the Right pane.

Then check “ISAPI Filters” and “ISAPI Extensions” and click “Next” and then click on Install

 

 

Now go back to IIS 7.0 and click on Default WebSite as shown below:

Click on ISAPI filters icon in Features View.

In the right pane click on Add

Enter any name of your choice for filter name

Click browse (…) and selects iisforward.dll from C:/inetpub/wwwroot and then ok

 

 

 

 

Next go back to Default Web Site, click on “Handler Mappings”

 

Click on the ‘Add Script Map…’ on the right hand side menu options. Enter * for the Request path. Browse to the iisproxy.dll file and add it as the executable. Name it as  ‘proxy’.

 

 

Click on the Request Restrictions… button and uncheck the box titled ‘Invoke handler only if the request is mapped to’.

 

 

Click Ok to add this Handler mapping. Click ‘Yes’ on the Add Script Map dialog box.

 

Similarly, if you want to configure proxying by path click on Add Script Map and give the Request path as ‘.wlforward’ and select the executable as iisproxy.dll.

Click on the Request Restrictions… button and uncheck the box titled ‘Invoke handler only if the request is mapped to’.

Click Ok to add this Handler mapping. Click ‘Yes’ on the Add Script Map dialog box.

 

Click on the Root node of the IIS Manager tree and click on the ISAPI and CGI Restrictions.

 

Then click on “Edit Feature Settings” on the right hand side menu options

Check the ‘Allow unspecified ISAPI modules’ checkbox and click Ok

 

 

Restart IIS. Go to Default Web site and click on Restart on the right hand side menu.

 

Now access the Example web-application through IIS at http://localhost/examplesWebApp

 

 

 

 

 

 

Configure Apache Webserver with Weblogic Server

Step 1) Make sure the Apache server runs on port 8080.( This is because sometimes IIS, or some antivirus s/w runs on that port).This can be done by modifying the httpd.conf present at
D:\Program Files\Apache Group\Apache2\conf
Modify the Listen port to 8080

Listen 8080

Step 2) Copy the mod_wl_20.so from <bea_home>\wlserver_10.3\server\plugin\win\32 to
D:\Program Files\Apache Group\Apache2\modules

Step 3) Add these lines in the httpd.conf file

LoadModule weblogic_module modules/mod_wl_20.so

<Location />
SetHandler weblogic-handler
</Location>

<IfModule mod_weblogic.c>
WebLogicCluster localhost:7003,localhost:7005
Debug ON
WLLogFile c:/temp/wlproxy.log
WLTempDir c:/temp
</IfModule>

Step 4) Restart Apache and access the application deployed on the Cluster using

http://localhost:8080/YourApp

This will forward the request to the Weblogic Cluster

You can check the headers sent and received to WLS in wlproxy.log file.

Let me know if you face any issues.

Configuring IIS with Weblogic Server

This is a simple example of Configuring IIS(running on default port 80) on Weblogic Server. Create two Weblogic Servers running on Port 7001 and 7003, create a Cluster and add the two Servers to the Cluster. Deploy an application on the Cluster and after the configuration on ISS, access the application as

http://localhost/myApp

Step-1). Make a directory on the IIS box for the plug-in.

For instance: c:\Inetpub\WLS_IIS_Plugin\

Step-2). Copy iisforward.dll and iisproxy.dll to this new directory. These files are located at:

10.0: \wlserver_10.0\server\plugin\win\32
10.3: \wlserver_10.3\server\plugin\win\32

Step-3).To install iisforward.dll as an ISAPI filter, do the following:

a). Go to Start->Administrative Tools->Internet Information Services (IIS) Manager
b). In the left pane, go to the active website (like “Default Web Site”) Right-click the active website and select Properties
c). Select the ISAPI Filters tab and press the Add button Filter name: WLS IIS Plugin (Or whatever you want)
d). Executable: C:\Inetpub\WLS_IIS_Plugin\iisforward.dll (Or whatever path you created)
e). Press OK twice, IIS6 does not allow the iisforward.dll ISAPI Extension to run by default.

To enable:
In the left pane of the Internet Information Services (IIS) Manager,click on Web Service Extension (located under the computer name)
In the right pane, highlight All Unknown ISAPI Extensions and press
the Allow button

Step-4).To map .wlforward to use iisproxy.dll, do the following:

a). In the left pane, drill down to the active website (like “Default Web Site”)
b). Right-click the active website and select Properties
c). Select Home Directory tab
d). Click the Configuration… button.
e). In the Application Mapping tab, click the Add… button.
i). Executable: C:\Inetpub\WLS_IIS_Plugin\iisproxy.dll
ii). Extension: .wlforward
f). Uncheck Verify that file exists
g). IMPORTANT: Ensure .wlforward is *not* mapped to iisforward.dll. While this seems intuitive, it is wrong. .wlforward maps to iisproxy.dll.
h). Press OK three times
i). Exit the IIS Manager MMC console.

Step-5).Create a text file named iisproxy.ini and place it in the plug-in directory (e.g. c:\Inetpub\WLS_IIS_Plugin\iisproxy.ini)

“iisproxy.ini”

————————-
WebLogicCluster=localhost:7001,localhost:7003
WlForwardPath=/
Debug=ALL
DebugConfigInfo=ON
WLLogFile=c:/temp/iisproxy.log
————————-

Step-6).Restart IIS using the following CLI statement: iisreset /restart

Step-7).Use a browser to access IIS. This will ‘turn on’ the IIS->WLSISAPI filter.

Step-8).Relaunch the IIS Manager and check the ISAPI filter tab to ensure the iisforward.dll is now ‘turned on’, as evidenced by a green arrow.

BASIC Authentication with Apache

Create user.txt with the username and password separated by colon

user.txt
testuser:testuser

Then use the htpasswd to encrypt the password

Apache2\bin>htpasswd.exe -b user.txt testuser testuser
Automatically using MD5 format.
Updating password for user testuser

Add the following in the httpd.conf file present in C:\Program Files\Apache Group\Apache2\bin

LoadModule weblogic_module modules/mod_wl128_20.so

<Location />
SetHandler weblogic-handler
WebLogicHost localhost
WebLogicPort 7001
Debug ALL
WLLogFile c:/muthu/wlproxy.log
WLTempDir c:/muthu
AuthUserFile C:/muthu/user.txt
AuthName “This is a protected area”
AuthType Basic
Require valid-user
</Location>

Also copy WL_HOME\server\plugin\win\32\mod_wl_22.so to C:\Program Files\Apache Group\Apache2\modules

Restart the Apache Server.

Now if we try to access any unprotected resource on Weblogic Server, a BASIC Authentication Window will be popped up for authentication against Apache.

If authentication is successful, the request will go through provided we set the following in the config.xml

<enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials>

Otherwise Weblogic Server will try to validate the BASIC authentication Header.