You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Giacomo Arru - BETA Technologies <gi...@beta.srl> on 2018/07/10 16:59:33 UTC

nginx + Tomcat 9

Hi, 
we are using nginx as proxy for our web app deployed in Tomcat 9. 

The app uses websocket. The websocket connection dies after 30/40 seconds and we can't figure out why. 

Any suggestions? 



Giacomo 







Non multa, sed multum 
Giacomo Arru 
Direttore commerciale - BETA Technologies 













[ https://betatechnologies.com/?giacomo-arru ] 


BETA Technologies Srl 
Cagliari - Loc. Scala Sa Perda 
ex SS. 131 km 10,8 09028 Sestu 


Re: nginx + Tomcat 9

Posted by Giacomo Arru - BETA Technologies <gi...@beta.srl>.
Hi, I installed and configured HAProxy as a basic proxy but I'm facing the same issues with my application war: 

-when I upload a file > 60k the upload fails (hangs) 
-websocket stops working after 30 seconds 

Maybe I need to tweak tomcat? 



Giacomo 


Da: "Harpreet Sandhu" <ha...@gmail.com> 
A: "users" <us...@tomcat.apache.org> 
Inviato: Venerdì, 13 luglio 2018 16:33:03 
Oggetto: Re: nginx + Tomcat 9 

You should go with HAProxy. I have used it in the infra of one of Payment 
Gateway.. 
It works really good. 
Let me know.. if I can help you in setting up HAProxy. 

Best, 
Harpreet Sandhu 

On Fri 13 Jul, 2018, 7:43 PM Giacomo Arru - BETA Technologies, 
<gi...@beta.srl> wrote: 

> Hi Simon, 
> 
> I only get oputput in logs with nginx debug, but it is way too much 
> verbose and I can't determine why the connection times out. 
> 
> I get no useful messages in tomcat logs neither. 
> 
> I think I'll set up and HAProxy test environment and see how it works with 
> my app and tomcat. 
> 
> I suspect I need the nginx+ payment options/support. I'm happy to pay but 
> I've read about HAProxy vs nginx and it may be better fitting my needs; so 
> it's worth the test. 
> 
> 
> Giacomo 
> 
> 
> 
> 
> 
> Da: "Simon De Uvarow" <sd...@gmail.com> 
> A: "users" <us...@tomcat.apache.org> 
> Inviato: Mercoledì, 11 luglio 2018 17:29:02 
> Oggetto: Re: nginx + Tomcat 9 
> 
> On Wed, Jul 11, 2018 at 10:41 AM Giacomo Arru - BETA Technologies 
> <gi...@beta.srl> wrote: 
> 
> > I tried to enable debug logging for org.apache.tomcat.websocket but 
> > without success 
> > 
> > here is my logging.properties 
> > 
> > 
> > 
> > handlers = java.util.logging.ConsoleHandler 
> > 
> > .handlers = 1catalina.org.apache.juli.AsyncFileHandler, 
> > java.util.logging.ConsoleHandler 
> > 
> > java.util.logging.ConsoleHandler.level = ALL 
> > java.util.logging.ConsoleHandler.formatter = 
> > org.apache.juli.OneLineFormatter 
> > 
> > org.apache.coyote.http2.level = ALL 
> > org.apache.tomcat.websocket.level = ALL 
> > org.apache.coyote.http11.Http11AprProtocol = ALL 
> > 
> > 
> > 
> > 
> > 
> > Giacomo 
> > 
> > 
> > 
> > 
> > 
> > Da: "Mark Thomas" <ma...@apache.org> 
> > A: "users" <us...@tomcat.apache.org> 
> > Inviato: Martedì, 10 luglio 2018 23:27:09 
> > Oggetto: nginx + Tomcat 9 
> > 
> > On 10/07/18 17:59, Giacomo Arru - BETA Technologies wrote: 
> > > Hi, 
> > > we are using nginx as proxy for our web app deployed in Tomcat 9. 
> > > 
> > > The app uses websocket. The websocket connection dies after 30/40 
> > seconds and we can't figure out why. 
> > > 
> > > Any suggestions? 
> > 
> > Turn on debug logging for the org.apache.tomcat.websocket package 
> > Mark 
> > 
> > --------------------------------------------------------------------- 
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org 
> > For additional commands, e-mail: users-help@tomcat.apache.org 
> > 
> > 
> > -- 
> > Questo messaggio stato analizzato con Libra ESVA ed risultato non 
> infetto. 
> > Seguire il link qui sotto per segnalarlo come spam: 
> > 
> 
> 
> I had a similar problem. I could resolved it by sending a keep alive 
> message from the browser. 
> If you still get disconnections (backend or middlerware could disconnect), 
> you need some logic in the frontend to restart the connection. 
> I didn't have to change any tomcat configuration, or the websocket code. 
> 
> You can test connecting direct to tomcat websocket (without nginx) to 
> check 
> where is the problem. 
> You can also read these nginx configs: 
> proxy_connect_timeout 
> proxy_read_timeout 
> 
> Hope it helps, 
> 
> 
> "No olvides, no traiciones, lo que llevas bien dentro de ti. No olvides, 
> no 
> traiciones, lo que siempre te ha hecho vivir." 
> 
> -- 
> Questo messaggio stato analizzato con Libra ESVA ed risultato non infetto. 
> Seguire il link qui sotto per segnalarlo come spam: 
> 

-- 
Questo messaggio stato analizzato con Libra ESVA ed risultato non infetto. 
Seguire il link qui sotto per segnalarlo come spam: 

Re: nginx + Tomcat 9

Posted by Harpreet Sandhu <ha...@gmail.com>.
You should go with HAProxy. I have used it in the infra of one of Payment
Gateway..
It works really good.
Let me know.. if I can help you in setting up HAProxy.

Best,
Harpreet Sandhu

On Fri 13 Jul, 2018, 7:43 PM Giacomo Arru - BETA Technologies,
<gi...@beta.srl> wrote:

> Hi Simon,
>
> I only get oputput in logs with nginx debug, but it is way too much
> verbose and I can't determine why the connection times out.
>
> I get no useful messages in tomcat logs neither.
>
> I think I'll set up and HAProxy test environment and see how it works with
> my app and tomcat.
>
> I suspect I need the nginx+ payment options/support. I'm happy to pay but
> I've read about HAProxy vs nginx and it may be better fitting my needs; so
> it's worth the test.
>
>
> Giacomo
>
>
>
>
>
> Da: "Simon De Uvarow" <sd...@gmail.com>
> A: "users" <us...@tomcat.apache.org>
> Inviato: Mercoledì, 11 luglio 2018 17:29:02
> Oggetto: Re: nginx + Tomcat 9
>
> On Wed, Jul 11, 2018 at 10:41 AM Giacomo Arru - BETA Technologies
> <gi...@beta.srl> wrote:
>
> > I tried to enable debug logging for org.apache.tomcat.websocket but
> > without success
> >
> > here is my logging.properties
> >
> >
> >
> > handlers = java.util.logging.ConsoleHandler
> >
> > .handlers = 1catalina.org.apache.juli.AsyncFileHandler,
> > java.util.logging.ConsoleHandler
> >
> > java.util.logging.ConsoleHandler.level = ALL
> > java.util.logging.ConsoleHandler.formatter =
> > org.apache.juli.OneLineFormatter
> >
> > org.apache.coyote.http2.level = ALL
> > org.apache.tomcat.websocket.level = ALL
> > org.apache.coyote.http11.Http11AprProtocol = ALL
> >
> >
> >
> >
> >
> > Giacomo
> >
> >
> >
> >
> >
> > Da: "Mark Thomas" <ma...@apache.org>
> > A: "users" <us...@tomcat.apache.org>
> > Inviato: Martedì, 10 luglio 2018 23:27:09
> > Oggetto: nginx + Tomcat 9
> >
> > On 10/07/18 17:59, Giacomo Arru - BETA Technologies wrote:
> > > Hi,
> > > we are using nginx as proxy for our web app deployed in Tomcat 9.
> > >
> > > The app uses websocket. The websocket connection dies after 30/40
> > seconds and we can't figure out why.
> > >
> > > Any suggestions?
> >
> > Turn on debug logging for the org.apache.tomcat.websocket package
> > Mark
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> > --
> > Questo messaggio stato analizzato con Libra ESVA ed risultato non
> infetto.
> > Seguire il link qui sotto per segnalarlo come spam:
> >
>
>
> I had a similar problem. I could resolved it by sending a keep alive
> message from the browser.
> If you still get disconnections (backend or middlerware could disconnect),
> you need some logic in the frontend to restart the connection.
> I didn't have to change any tomcat configuration, or the websocket code.
>
> You can test connecting direct to tomcat websocket (without nginx) to
> check
> where is the problem.
> You can also read these nginx configs:
> proxy_connect_timeout
> proxy_read_timeout
>
> Hope it helps,
>
>
> "No olvides, no traiciones, lo que llevas bien dentro de ti. No olvides,
> no
> traiciones, lo que siempre te ha hecho vivir."
>
> --
> Questo messaggio stato analizzato con Libra ESVA ed risultato non infetto.
> Seguire il link qui sotto per segnalarlo come spam:
>

Re: nginx + Tomcat 9

Posted by Giacomo Arru - BETA Technologies <gi...@beta.srl>.
Hi Simon, 

I only get oputput in logs with nginx debug, but it is way too much verbose and I can't determine why the connection times out. 

I get no useful messages in tomcat logs neither. 

I think I'll set up and HAProxy test environment and see how it works with my app and tomcat. 

I suspect I need the nginx+ payment options/support. I'm happy to pay but I've read about HAProxy vs nginx and it may be better fitting my needs; so it's worth the test. 


Giacomo 





Da: "Simon De Uvarow" <sd...@gmail.com> 
A: "users" <us...@tomcat.apache.org> 
Inviato: Mercoledì, 11 luglio 2018 17:29:02 
Oggetto: Re: nginx + Tomcat 9 

On Wed, Jul 11, 2018 at 10:41 AM Giacomo Arru - BETA Technologies 
<gi...@beta.srl> wrote: 

> I tried to enable debug logging for org.apache.tomcat.websocket but 
> without success 
> 
> here is my logging.properties 
> 
> 
> 
> handlers = java.util.logging.ConsoleHandler 
> 
> .handlers = 1catalina.org.apache.juli.AsyncFileHandler, 
> java.util.logging.ConsoleHandler 
> 
> java.util.logging.ConsoleHandler.level = ALL 
> java.util.logging.ConsoleHandler.formatter = 
> org.apache.juli.OneLineFormatter 
> 
> org.apache.coyote.http2.level = ALL 
> org.apache.tomcat.websocket.level = ALL 
> org.apache.coyote.http11.Http11AprProtocol = ALL 
> 
> 
> 
> 
> 
> Giacomo 
> 
> 
> 
> 
> 
> Da: "Mark Thomas" <ma...@apache.org> 
> A: "users" <us...@tomcat.apache.org> 
> Inviato: Martedì, 10 luglio 2018 23:27:09 
> Oggetto: nginx + Tomcat 9 
> 
> On 10/07/18 17:59, Giacomo Arru - BETA Technologies wrote: 
> > Hi, 
> > we are using nginx as proxy for our web app deployed in Tomcat 9. 
> > 
> > The app uses websocket. The websocket connection dies after 30/40 
> seconds and we can't figure out why. 
> > 
> > Any suggestions? 
> 
> Turn on debug logging for the org.apache.tomcat.websocket package 
> Mark 
> 
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org 
> For additional commands, e-mail: users-help@tomcat.apache.org 
> 
> 
> -- 
> Questo messaggio stato analizzato con Libra ESVA ed risultato non infetto. 
> Seguire il link qui sotto per segnalarlo come spam: 
> 


I had a similar problem. I could resolved it by sending a keep alive 
message from the browser. 
If you still get disconnections (backend or middlerware could disconnect), 
you need some logic in the frontend to restart the connection. 
I didn't have to change any tomcat configuration, or the websocket code. 

You can test connecting direct to tomcat websocket (without nginx) to check 
where is the problem. 
You can also read these nginx configs: 
proxy_connect_timeout 
proxy_read_timeout 

Hope it helps, 


"No olvides, no traiciones, lo que llevas bien dentro de ti. No olvides, no 
traiciones, lo que siempre te ha hecho vivir." 

-- 
Questo messaggio stato analizzato con Libra ESVA ed risultato non infetto. 
Seguire il link qui sotto per segnalarlo come spam: 

Re: nginx + Tomcat 9

Posted by Simon De Uvarow <sd...@gmail.com>.
On Wed, Jul 11, 2018 at 10:41 AM Giacomo Arru - BETA Technologies
<gi...@beta.srl> wrote:

> I tried to enable debug logging for org.apache.tomcat.websocket but
> without success
>
> here is my logging.properties
>
>
>
> handlers = java.util.logging.ConsoleHandler
>
> .handlers = 1catalina.org.apache.juli.AsyncFileHandler,
> java.util.logging.ConsoleHandler
>
> java.util.logging.ConsoleHandler.level = ALL
> java.util.logging.ConsoleHandler.formatter =
> org.apache.juli.OneLineFormatter
>
> org.apache.coyote.http2.level = ALL
> org.apache.tomcat.websocket.level = ALL
> org.apache.coyote.http11.Http11AprProtocol = ALL
>
>
>
>
>
> Giacomo
>
>
>
>
>
> Da: "Mark Thomas" <ma...@apache.org>
> A: "users" <us...@tomcat.apache.org>
> Inviato: Martedì, 10 luglio 2018 23:27:09
> Oggetto: nginx + Tomcat 9
>
> On 10/07/18 17:59, Giacomo Arru - BETA Technologies wrote:
> > Hi,
> > we are using nginx as proxy for our web app deployed in Tomcat 9.
> >
> > The app uses websocket. The websocket connection dies after 30/40
> seconds and we can't figure out why.
> >
> > Any suggestions?
>
> Turn on debug logging for the org.apache.tomcat.websocket package
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> --
> Questo messaggio stato analizzato con Libra ESVA ed risultato non infetto.
> Seguire il link qui sotto per segnalarlo come spam:
>


I had a similar problem. I could resolved it by sending a keep alive
message from the browser.
If you still get disconnections (backend or middlerware could disconnect),
you need some logic in the frontend to restart the connection.
I didn't have to change any tomcat configuration, or the websocket code.

You can test connecting direct to tomcat websocket (without nginx) to check
where is the problem.
You can also read these nginx configs:
proxy_connect_timeout
proxy_read_timeout

Hope it helps,


"No olvides, no traiciones, lo que llevas bien dentro de ti. No olvides, no
traiciones, lo que siempre te ha hecho vivir."

Re: nginx + Tomcat 9

Posted by Giacomo Arru - BETA Technologies <gi...@beta.srl>.
I tried to enable debug logging for org.apache.tomcat.websocket but without success 

here is my logging.properties 



handlers = java.util.logging.ConsoleHandler 

.handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler 

java.util.logging.ConsoleHandler.level = ALL 
java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter 

org.apache.coyote.http2.level = ALL 
org.apache.tomcat.websocket.level = ALL 
org.apache.coyote.http11.Http11AprProtocol = ALL 





Giacomo 





Da: "Mark Thomas" <ma...@apache.org> 
A: "users" <us...@tomcat.apache.org> 
Inviato: Martedì, 10 luglio 2018 23:27:09 
Oggetto: nginx + Tomcat 9 

On 10/07/18 17:59, Giacomo Arru - BETA Technologies wrote: 
> Hi, 
> we are using nginx as proxy for our web app deployed in Tomcat 9. 
> 
> The app uses websocket. The websocket connection dies after 30/40 seconds and we can't figure out why. 
> 
> Any suggestions? 

Turn on debug logging for the org.apache.tomcat.websocket package 
Mark 

--------------------------------------------------------------------- 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org 
For additional commands, e-mail: users-help@tomcat.apache.org 


-- 
Questo messaggio stato analizzato con Libra ESVA ed risultato non infetto. 
Seguire il link qui sotto per segnalarlo come spam: 

nginx + Tomcat 9

Posted by Mark Thomas <ma...@apache.org>.
On 10/07/18 17:59, Giacomo Arru - BETA Technologies wrote:
> Hi, 
> we are using nginx as proxy for our web app deployed in Tomcat 9. 
> 
> The app uses websocket. The websocket connection dies after 30/40 seconds and we can't figure out why. 
> 
> Any suggestions?

Turn on debug logging for the org.apache.tomcat.websocket package
Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: nginx + Tomcat 9

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
On 10.07.2018 18:59, Giacomo Arru - BETA Technologies wrote:
> Hi,
> we are using nginx as proxy for our web app deployed in Tomcat 9.
>
> The app uses websocket. The websocket connection dies after 30/40 seconds and we can't figure out why.
>
> Any suggestions?
>

- look at the logs ? (of nginx as well as tomcat)
- try to define "dies" a bit more precisely ?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org