# Ask help for nginx and tomcat

**URL:** <https://www.ruby-forum.com/t/ask-help-for-nginx-and-tomcat/169389>\
**Category:** NGINX\
**Created:** [June 3, 2009, 7:33am UTC](https://www.ruby-forum.com/t/ask-help-for-nginx-and-tomcat/169389 "2009-06-03T07:33:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![niedh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/73ab20/32.png) [@niedh](https://www.ruby-forum.com/u/niedh)\
**Post date:** [June 3, 2009, 7:33am UTC](https://www.ruby-forum.com/t/ask-help-for-nginx-and-tomcat/169389/1 "2009-06-03T07:33:16Z")

</div>

Hi everybody,  
I’m new to nginx. Recently I use comet in my project. I choose tomcat  
for the java server. and enable the Http11NioProtocol connector.  
client send a ajax request,and the server side suspend it, and set a  
timeout(5 seconds),when timeout reach,the tomcat end the response  
in tomat server.xml

when I test with tomcat directly, means [http://localhost:8080/xxxxx](http://localhost:8080/xxxxx),  
it works as what I expect,  
but when I use nginx to proxy, when the timeout reach,the tomcat server  
end the response,but the request still there,  
nginx wait for its own “request timeout”(I don’t what to call it).  
in nginx.conf,I set the follow proxy-relative config  
proxy\_buffering off;  
proxy\_redirect off;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For  
$proxy\_add\_x\_forwarded\_for;

is there something i missed ? Any suggestion will be appreciate…  
thanks

---

<div class="post-metadata">

**Author:** ![niedh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/73ab20/32.png) [@niedh](https://www.ruby-forum.com/u/niedh)\
**Post date:** [June 3, 2009, 2:14pm UTC](https://www.ruby-forum.com/t/ask-help-for-nginx-and-tomcat/169389/2 "2009-06-03T14:14:52Z")

</div>

Can you tie Tomcat to Apache and use Nginx as a front end proxy? Would  
that  
be easier to manage since Tomcat is built for Apache?

On Wed, Jun 3, 2009 at 10:12 AM, Claude B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > in tomat server.xml  
> > in nginx.conf,I set the follow proxy-relative config
> 
> –
> 
> George Bernard Shaw[http://www.brainyquote.com/quotes/authors/g/george\_bernard\_shaw.html](http://www.brainyquote.com/quotes/authors/g/george_bernard_shaw.html) - “A government that robs Peter to pay Paul can always depend on the  
> support of Paul.”

–

H. L. Mencken  
[http://www.brainyquote.com/quotes/authors/h/h\_l\_mencken.html](http://www.brainyquote.com/quotes/authors/h/h_l_mencken.html)

- “Nobody ever went broke underestimating the taste of the American  
public.”

---

<div class="post-metadata">

**Author:** ![niedh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/73ab20/32.png) [@niedh](https://www.ruby-forum.com/u/niedh)\
**Post date:** [June 3, 2009, 10:22am UTC](https://www.ruby-forum.com/t/ask-help-for-nginx-and-tomcat/169389/3 "2009-06-03T10:22:34Z")

</div>

Please don’t send twice.

On Wed, Jun 3, 2009 at 7:23 AM, niedh [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> 
> ```
> 
> is there something i missed ? Any suggestion will be appreciate.. thanks

–

George Bernard  
Shaw[http://www.brainyquote.com/quotes/authors/g/george\_bernard\_shaw.html](http://www.brainyquote.com/quotes/authors/g/george_bernard_shaw.html)

- “A government that robs Peter to pay Paul can always depend on the  
support of Paul.”

---

<div class="post-metadata">

**Author:** ![niedh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/73ab20/32.png) [@niedh](https://www.ruby-forum.com/u/niedh)\
**Post date:** [June 20, 2009, 6:35pm UTC](https://www.ruby-forum.com/t/ask-help-for-nginx-and-tomcat/169389/4 "2009-06-20T18:35:35Z")

</div>

On Jun 03, niedh wrote:

> ```
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> 
> ```
> 
> is there something i missed ? Any suggestion will be appreciate.. thanks

Try this:

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com
