# Nginx Load balancer mode for JBoss / Icefaces application

**URL:** <https://www.ruby-forum.com/t/nginx-load-balancer-mode-for-jboss-icefaces-application/213855>\
**Category:** NGINX\
**Created:** [November 14, 2011, 2:05pm UTC](https://www.ruby-forum.com/t/nginx-load-balancer-mode-for-jboss-icefaces-application/213855 "2011-11-14T14:05:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [November 14, 2011, 2:05pm UTC](https://www.ruby-forum.com/t/nginx-load-balancer-mode-for-jboss-icefaces-application/213855/1 "2011-11-14T14:05:32Z")

</div>

Hello  
We have setup nginx as a Loadbalancer on Centos 5.2 x64. nginx is  
acting as a LB for a web application developed using Java servlets and  
Icefaces (1.8.2). The web application is deployed on JBoss 5.1. After  
configuration nginx is able to redirect the queries to the upstream  
servers properly. However the session information is not being passed  
through or is being modified. So the Icefaces servlet is repeatedly  
refreshing the login page every few seconds and keeps creating new  
sessions.  
Please advise on any additional settings that need to be made. The  
current settings are:  
(nginx is running on 192.168.1.137)  
upstream int-lb { server 192.168.1.139:8080; server  
192.168.1.138:8080;}  
server { listen 80; server\_name int-lb;  
#charset koi8-r; access\_log /var/log/nginx/host.access.log  
main; error\_log /var/log/nginx/host.error.log debug; root  
/usr/app/jboss5/server/default/deploy/admin-console.war;  
location / { proxy\_set\_header X-Forwarded-Host $host;  
proxy\_set\_header X-Forwarded-Server $host; proxy\_set\_header  
X-Forwarded-For $proxy\_add\_x\_forwarded\_for; proxy\_pass  
[http://int-lb](http://int-lb); }}  
Thanks in advance for all assistance.

Regards  
Srini

---

<div class="post-metadata">

**Author:** ![admin123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@admin123](https://www.ruby-forum.com/u/admin123)\
**Post date:** [November 15, 2011, 3:48am UTC](https://www.ruby-forum.com/t/nginx-load-balancer-mode-for-jboss-icefaces-application/213855/2 "2011-11-15T03:48:17Z")

</div>

However the session information is not being passed through or is being  
modified.

How do you know that? I think the problem is the session is sent to be  
the  
wrong jboss server.

If the Jboss uses the similar session sticky way as Tomcat/Resin, you  
can  
use my nginx\_jvm\_route\_module:  
[http://code.google.com/p/nginx-upstream-jvm-route/](http://code.google.com/p/nginx-upstream-jvm-route/)

2011/11/14 Srinivasan S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![admin123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@admin123](https://www.ruby-forum.com/u/admin123)\
**Post date:** [November 15, 2011, 4:19am UTC](https://www.ruby-forum.com/t/nginx-load-balancer-mode-for-jboss-icefaces-application/213855/3 "2011-11-15T04:19:06Z")

</div>

Hi  
You were bang on! Thanks. That was the issue. For now i introduced  
the ip\_hask; key for now in the upstream section and that fixed it.  
I will try your module. We want to actually also implement the  
HttpUpstreamFairModule to improve the distribution. Will the sticky  
session module that you linked to work in conjunction with that?  
Thanks for your timely help, greatly appreciated.  
Regards

Date: Tue, 15 Nov 2011 10:47:53 +0800  
Subject: Re: Nginx Load balancer mode for JBoss / Icefaces application  
From: removed\_email\_address@domain.invalid  
To: removed\_email\_address@domain.invalid

However the session information is not being passed through or is being  
modified.

How do you know that? I think the problem is the session is sent to be  
the wrong jboss server.  
If the Jboss uses the similar session sticky way as Tomcat/Resin, you  
can use my nginx\_jvm\_route\_module:  
[http://code.google.com/p/nginx-upstream-jvm-route/](http://code.google.com/p/nginx-upstream-jvm-route/)

2011/11/14 Srinivasan S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Hello  
We have setup nginx as a Loadbalancer on Centos 5.2 x64. nginx is  
acting as a LB for a web application developed using Java servlets and  
Icefaces (1.8.2). The web application is deployed on JBoss 5.1. After  
configuration nginx is able to redirect the queries to the upstream  
servers properly. However the session information is not being passed  
through or is being modified. So the Icefaces servlet is repeatedly  
refreshing the login page every few seconds and keeps creating new  
sessions.

Please advise on any additional settings that need to be made. The  
current settings are:

(nginx is running on 192.168.1.137)  
upstream int-lb {  
server 192.168.1.139:8080; server 192.168.1.138:8080;  
}  
server { listen 80;  
server\_name int-lb;  
#charset koi8-r; access\_log /var/log/nginx/host.access.log  
main;  
error\_log /var/log/nginx/host.error.log debug; root  
/usr/app/jboss5/server/default/deploy/admin-console.war;

```
location / { proxy_set_header X-Forwarded-Host $host; 

```

proxy\_set\_header X-Forwarded-Server $host;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
proxy\_pass [http://int-lb](http://int-lb);  
}}  
Thanks in advance for all assistance.

Regards  
Srini

* * *

nginx mailing list

removed\_email\_address@domain.invalid

[http://mailman.nginx.org/mailman/listinfo/nginx](http://mailman.nginx.org/mailman/listinfo/nginx)
