Showing posts with label iPlanet. Show all posts
Showing posts with label iPlanet. Show all posts

Wednesday, October 15, 2014

Site Down Maintenance page in iPlanet

When ever your site is going to Schedule Maintenance or Down due to some issues at back end servers. Is it good to show 404 or 500 Page errors to users?. No , in this situation we need to build the custom Site Maintenance pages.

How to configure Site Maintenance Page in iPlanet?
  • Add below configuration lines in obj.conf file
        <Client urlhost="examplesite.com">
                 NameTrans fn="redirect" from="/" url="/Site_Maintenance_Page.htm"
        </Client>
  • Push or Deploy the configuration changes . No need of the server restart.
How to display the site logs or Images in Maintenance Page?
  • If you are using the images or static files to display your site Maintenance page to looks good you may face the problems.

    • How to solve it ?
      • Rewrite your static files as below
    • NameTrans fn="rewrite" from="/Site_Maintenance_Page/site_logo.png" root="/opt/iplanet" path="/Site_Maintenance_Page/site_logo.png"
    • NameTrans fn="rewrite" from="/Site_Maintenance_Page/Site_body.jpg" root="/opt/iplanet" path="/Site_Maintenance_Page/Site_body.jpg" 

 Note: Make sure Rewrite directive configuration should be placed before the redirect directive , other static images or files wont access.
  • Overall Configuration looks like
<Client urlhost="examplesite.com">
           NameTrans fn="rewrite" from="/Site_Maintenance_Page/site_logo.png" root="/opt/iplanet"                 path="/Site_Maintenance_Page/site_logo.png"

            NameTrans fn="rewrite" from="/Site_Maintenance_Page/Site_body.jpg" root="/opt/iplanet"               path="/Site_Maintenance_Page/Site_body.jpg"
            NameTrans fn="redirect" from="/" url="/Site_Maintenance_Page.htm"
</Client>

Tuesday, October 14, 2014

Tomcat Integration with iPlanet Webserver

AJP  (Apache JServ protocol ) is a communications protocol developed by apache.org to facilitate integration of the Tomcat web container with third party web servers. Web server specific AJP plugins have been developed for Apache, IIS and  iPlanet.nsapi_redirector.so Plugin developed to integrate the Tomcat server with iPlanet webserver.

How to Integrate the Tomcat server with iPlanet ?

  • Load the nsapi_redirector.so plugin and worker.properties in magnus.conf file 
Init fn="load-modules" funcs="jk_init,jk_service" shlib="/opt/iplanet//lib/nsapi_redirector.so"
Init fn="jk_init" worker_file="/opt/iplanet/worker.properties" log_level="debug" log_file="/opt/iplanet/nsapi.log"
  • Create the Worker Properties file 
/opt/iplanet/worker.properties
------------------------------------------------
# List of workers for handling incoming requests
worker.list=Worker1
worker.Worker1.host=Tomcat-Host-name.com
worker.Worker1.port=8009
worker.Worker1.type=ajp13
worker.Worker1.cachesize=100
worker.Worker1.lbfactor=1
  • Add NameTran function in obj.conf file
         NameTrans fn="assign-name" from="/Tomcat-app/*" name="Tomcat-app"
        <Object name="Tomcat-app">
            Service fn="jk_service" worker="Worker1"
      </Object>

Note: If you have custom Custom-obj.conf file (Virtual servers) and has client configuration your  Reverse proxy configuration is as below.
Custom-obj.conf
-----------------------------------------------------
<Object name="default">
     <Client urlhost="example-server.com">
          NameTrans fn="assign-name" from="/Tomcat-app/*" name="Tomcat-app"
     </Client>
</Object>

<Object name="Tomcat-app">
         Service fn="jk_service" worker="Worker1"
</Object>

Friday, October 10, 2014

Reverse Proxy configuration in iPlanet Web server

A Reverse Proxy is a type of server that retrieves resources from other servers on behalf of the client. The resources are returned to the client as though they are originated from the server itself. Client feels that the resources are being provided by the server itself, and unaware of the servers that have provided the resources.Forward proxy acts as an intermediary for its clients and returns the resources accessible on the internet.Reverse proxy acts as an intermediary for the servers to return the resources provided by other servers.Reverse proxy is most widely used when you want your application accessible in the internet, without exposing the Application Servers, in other words, it is used when you want your intranet application to be accessible through internet.The proxied server may be a webserver itself, or it may be an application server using a different protocol, or an application server.


How to Configure Reverse Proxy in iPlanet?

iPlanet 7 and above versions has inbuilt proxy plugins , so no need to load any plugins or libraries.
  • Add below configuration lines in obj.conf file.
          NameTrans fn="map" from="/Revese_Proxy" name="reverse-proxy" to="http:/Revese_Proxy"
             <Object name="reverse-proxy">
                  Route fn="set-origin-server" server="http://backendserver.com"
             </Object>

            <Object ppath="http:*">
                Service fn="proxy-retrieve" method="*"
            </Object>
  • Push/ Deploy the changes in iPlanet console. No need of restart.
Note: If you have custom Custom-obj.conf file (Virtual servers) and has client configuration your  Reverse proxy configuration is as below.

Custom-obj.conf
-----------------------------------------------------
<Object name="default">
     <Client urlhost="Reverse-Proxy-server.com">
          NameTrans fn="map" from="/Revese_Proxy" name="reverse-proxy" to="http:/Revese_Proxy"
     </Client>
</Object>

<Object name="reverse-proxy">
          Route fn="set-origin-server" server="http://backendserver.com"
</Object>

<Object ppath="http:*">
          Service fn="proxy-retrieve" method="*"
</Object>

Note:  Only one ppath="http:*" is required for multiple Reverse Proxy configuration. No need to duplicate the ppath block every time.

How Reverse Proxy works ?

When request comes to iplanet let ex http://Reverse-Proxy-server.com/Revese_Proxy
  • The default object NameTrans  directive  map  attribute function will be execute and  convert the logical URL of the request to a physical path name.
NameTrans fn="map" from="/Revese_Proxy" name="reverse-proxy" to="http:/Revese_Proxy"
  • If this physical path name (http:/Revese_Proxy) matches the  Object ppath="http:*" , ppath object directive proxy-retrieve function will be execute.
             <Object ppath="http:*">
                   Service fn="proxy-retrieve" method="*"
             </Object>

  • proxy-retrieve
    • The proxy-retrieve function retrieves a information from a remote server and returns it to the client. This function also enables you to configure the server to allow or block arbitrary methods. This function only works on the HTTP protocol.
  • After execution of the ppath Object proxy-retrieve  function ,process goes to the Object name="reverse-proxy" block.
               <Object name="reverse-proxy">
                    Route fn="set-origin-server" server="http://backendserver.com"
               </Object>
  • Route fn="set-origin-server
    • Set the back end  server information where to send the request .

 Alternative ways to configure the Reverse Proxy in iPlanet

  • Below configuration works same as above one but difference is removed the name attribute in NameTrans  and added the Route function in ppath Object.
           <Object name="default">
                  <Client urlhost="Reverse-Proxy-server.com">
                        NameTrans fn="map" from="/Revese_Proxy"  to="http:/Revese_Proxy"
                  </Client>
           </Object>

          <Object ppath="http:*">
                 Service fn="proxy-retrieve" method="*"
                 Route fn="set-origin-server" server="http://backendserver.com"
         </Object>

Sunday, July 6, 2014

Cache controls for static files in iPlanet (Sun One Webserver)

Browser caching behavior is also subject to Web server settings for static file caching. Appropriate settings allow files that are rarely updated, such as image files, JavaScript files, or style sheet files, to be cached on the browser. Caching static files reduces network utilization and enhances Web Client response time.

  • we can enable the cache control for iplanet web server by adding  below tags in obj.conf file 


<If $path =~ "^(.*)(\\.)(jpg|jpeg|gif|png|js|css|woff)$">

      ObjectType fn="set-variable" insert-srvhdrs="Expires:$(httpdate($time + 64000))"
      ObjectType fn="set-cache-control" control="public,max-age=64000"

</If>
  • We can verify the Cache controls in web browser HTTP headers.