What is proxy server ?
Proxy server is a component, it will redirect all the request to your main server which is more scalable and durable. Here main server is weblogic. Proxy server is any third party server.
Why we need to use proxy server ? in which situation we need this ?
Proxy server is used between the client and server as an intermediate server, like, it will hide the main server details or its details.
To understand proxy server, we need some practical example,
Assume, we are running a pizza shop, it should run for 24 hours, our shop dns name is rampwaq.com , now you registered with this domain name and your IP address is 10.11.94.06 with this IP address and 7001 port weblogic server is running, rampwaq_pizza enterprise web application (ear file) running on weblogic.
Now users are accessing the application using the following url,
http://rampwaq.com:7001/jsp/home.jsp
Initially some 100 users are accessing this application, its working fine and our pizza was good, the number of clients are increasing to 10,000 now we are getting out of memory error, we need to increase the RAM size to handle our clients, the management decided to buy new hardware with extended memory and with different IP address or due to some firewall settings we are changing the IP address.
Now the IP addresss is 11.11.11.11, it should mapped with DNS server for the domain name, its again a separate task for the management to mapping the IP Address with DNS name.
Now rampwaq.com management is reporting to weblogic we are getting this problem (like changing the IP address and mapping it with DNS name), now weblogic is coming with a solution called Proxy server.
Proxy server is a third party “apache http server”, DNS name, rampwaq.com is mapped with the IP address of “Apache Http Server” IP Address not with weblogic server IP Address.
http://rampwaq.com is mapped with (100.100.100.100)
The probability for “weblogic machine going down” is high compare to apache server machine, we can say “nil for apache server machine” because apache server is not doing anything other than just redirecting the request to weblogic server.
The structure is like this,
Today weblogic is running on 11.11.11.11 or 12.12.12.12, if we change to some other IP address also, it wont affect clients directly or indirectly, because they will contact only proxy server, the only place we need to change the IP Address of weblogic is “Proxy server” specifically in configuration file of the apache server (httpd.conf)
Now we will see how the proxy is happening from apache server to weblogic.
Apache server will redirect the request from client to weblogic based on some condition,
It is classified in two types,
1. proxy by path
2. proxy by MIME type
Now may be you will get this question, why we need these conditions?
Assume, our clients using our site to get the menu of pizzas and its price, if they choose any one type of pizza, then they will register their contact details and the pizza will be delivered to them.
There are 2 tasks for our site:
1. Display the menu with price
2. Register user info and map the pizza which they want
For the first task we need only, HTML pages, so its not necessary to go to weblogic server to display these html pages.
For the second task we need JSP and the JSP’s are calling some EJBs and its configured with data source JNDI.
Note: If you feel, for your application, EJB is not required and its not an enterprise application then you can use web server (like, Tomcat) no need to choose weblogic. (no need for proxy)
Ok, come again to the first task, like there are some HTML pages which we need to display, so it will be deployed on apache server itself and its not necessary to deploy it in weblogic.
Now we need proxy by MIME or Path,
Client request will be answered by your proxy server,
If client is looking for only html pages – now you can use proxy by MIME type
If client is looking for JSP pages then it will be redirected to weblogic
“By Path” method also doing the same, here servlet name will taken into account, from our url (http://rampwaq.com:7001/jsp/home.jsp),
Client request will be redirected to weblogic if folder name (or servlet name) is HTML then it will answered by apache server else if folder name is JSP it will answered by weblogic.
These configuration changes will be done in the httpd.conf file of apache http server, like thise,
IfModule mod_weblogic.c
WebLogicHost myweblogic.server.com
WebLogicPort 7001
MatchExpression *.jsp
MatchExpression *.xyz
IfModule
Here we are using “Proxy by MIME“ method, only JSP and XYZ files request is redirect to weblogic and weblogic server information is mentioned, the above configuration for “Non clustered environment”
For clustered environment,
IfModule mod_weblogic.c
WebLogicCluster w1s1.com:7001,w1s2.com:7001,w1s3.com:7001
MatchExpression *.jsp
MatchExpression *.xyz
IfModule
How proxy server used for Load sharing?
We can say html pages contains some part of load your web application and it was deployed on proxy server, so proxy server is sharing the load of weblogic.
The following questions will be answered in next post,
How proxy server used for Load Balancing?
How Proxy server used for “Fail over”?
What is Keep-alive and “Keep-alive timeout”?