Problems with upstream

Hello,

I am working on replacing our Kemp Loadbalancers with nginx and so far,
things look good except for a minor issue. When a request comes into my
server on the HTTP port, our JBoss server uses ACEGI to redirect to
https://www.myserver.com/dev/home. The first time this redirection
occurs, I’m sent to the URL of my proxy_pass directive.

I am running version 0.7.65 stable on CentOS 5.4. Here is my
configuration file:

error_log /var/log/nginx_error.log;
worker_processes 2;

events {
worker_connections 4096;
}

http {
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;

upstream jboss_dev_servers {
server 192.168.2.86:8080;
server 192.168.2.87:8080;
}

server {
listen 80;
listen 443 default ssl;
access_log /var/log/nginx_access.log;
keepalive_timeout 70;
server_name www.myserver.com;
ssl_certificate dev.crt;
ssl_certificate_key dev.key;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!ADH:!MD5;
location / {
proxy_pass http://jboss_dev_servers;
}
}
}

When a user types in www.myserver.com, they are redirected to
https://jboss_dev_servers/dev/home. If I hit refresh, they are then
directed to the proper url (https://www.myserver.com/dev/home/) and the
web page displays.

Any ideas?

Posted at Nginx Forum:

On Tue, Apr 20, 2010 at 3:22 PM, mevans336 [email protected] wrote:

When a user types in www.myserver.com, they are redirected to https://jboss_dev_servers/dev/home. If I hit refresh, they are then directed to the proper url (https://www.myserver.com/dev/home/) and the web page displays.

Any ideas?

proxy_set_header Host $host;

The above is required for one of my JBoss apps, which uses Tomcat
security. The back-end doesn’t do relative redirects, and takes
whatever is in the host header from the client when constructing
redirect URLs. So you have to send it the host name.


RPM

Thanks Ryan, that did it. Any other tips for nginx and JBoss/Tomcat?

Posted at Nginx Forum:

On Tuesday, April 20, 2010, mevans336 [email protected] wrote:

Thanks Ryan, that did it. Any other tips for nginx and JBoss/Tomcat?

Just make sure you explicitly set explicit thread pool settings and
timeouts on the tomcat side. We discovered that even though the
documentation specifies a deault of 250 threads, the default was
actually 40. This departure from the documentation was confirmed by
load testing and looking at the running connector settings in
jmx-console.


RPM