Welcome! Log In Create A New Profile

Advanced

nginx -> httpd -> mod_jk -> tomcat

Posted by Giacomo Arru - BETA Technologies 
Giacomo Arru - BETA Technologies
nginx -> httpd -> mod_jk -> tomcat
July 26, 2018 10:20AM
Hi everybody,

I recently begun using proxy with nginx (same tests were made with haproxy).

My needs are to proxy for failover and balancing tomcat: I need to serve lots of users with production app.


While I understood that a 100% tomcat AJP1.3 compatibility is achievable with apache httpd only and mod_jk, I successfully serve my app with apache to a simple 80 http port (cookie path already patched). So I decided to have a localhost apache httpd to proxy tomcat with AJP. IT works perfectly.

Now, I need to proxy httpd with nginx, adding SSL with letsencrypt. I successfuly configured the proxy and everything works but uploads: if I send a file to my app, only small uploads work.

I'd like to investigate the headers, maybe I need to transform some string but I'm a completely newbie from this point of view.

Do you have some tips on how to investigate the problem?


Thanks,




Giacomo Arru
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Aleksandar Lazic
Re: nginx -> httpd -> mod_jk -> tomcat
July 28, 2018 06:50PM
Hi.

On 26/07/2018 10:06, Giacomo Arru - BETA Technologies wrote:
>Hi everybody,
>
>I recently begun using proxy with nginx (same tests were made with
>haproxy).

Which one do you prefer as both are very good and have similar features.

>My needs are to proxy for failover and balancing tomcat: I need to
>serve lots of users with production app.
>
>While I understood that a 100% tomcat AJP1.3 compatibility is
>achievable with apache httpd only and mod_jk, I successfully serve my
>app with apache to a simple 80 http port (cookie path already
>patched). So I decided to have a localhost apache httpd to proxy tomcat
>with AJP. IT works perfectly.

For which particular feature do you need ajp?
I have used several tomcats with httpd with ajp but after some horrible
errors we switched to http connector.
https://tomcat.apache.org/tomcat-9.0-doc/config/http.html

In case you don't need a special feature in httpd this makes also
possible to reduce the complexity of your chain ;-)

nginx (http/https/server static files) -> tomcat

>Now, I need to proxy httpd with nginx, adding SSL with letsencrypt. I
>successfuly configured the proxy and everything works but uploads: if I
>send a file to my app, only small uploads work.
>
>I'd like to investigate the headers, maybe I need to transform some
>string but I'm a completely newbie from this point of view.
>
>Do you have some tips on how to investigate the problem?

With small you mean ~1M, that's the default setup for

client_max_body_size
https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size

>Thanks,
>
>Giacomo Arru

Best regards
Aleks
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Giacomo Arru - BETA Technologies
Re: nginx -> httpd -> mod_jk -> tomcat
July 30, 2018 12:50PM
Hi Aleksandar, thank you for your reply.


> For which particular feature do you need ajp?
> I have used several tomcats with httpd with ajp but after some horrible
> errors we switched to http connector.

We wanted to use HTTP Connector, and set it up. But we couldn't manage to make the app work correctly: we coudn't upload files > 60k and tweaking nginx and tomcat configuration wouldn't help. We were unable to debug the problem. With AJP connector, all features work fine. The app is developed with Vaadin 8.
We have no static files in our app because they already are served with a CDN.

We would like test nginx with AJP connector (if somehow supported!).

client_max_body_size is set to 128m

so I think the problem occurs at http level while uploading files but I can't manage to debug my system.






Giacomo



Da: "Aleksandar Lazic" <[email protected]>
A: "nginx" <[email protected]>
Inviato: Sabato, 28 luglio 2018 18:41:59
Oggetto: Re: nginx -> httpd -> mod_jk -> tomcat

Hi.

On 26/07/2018 10:06, Giacomo Arru - BETA Technologies wrote:
>Hi everybody,
>
>I recently begun using proxy with nginx (same tests were made with
>haproxy).

Which one do you prefer as both are very good and have similar features.

>My needs are to proxy for failover and balancing tomcat: I need to
>serve lots of users with production app.
>
>While I understood that a 100% tomcat AJP1.3 compatibility is
>achievable with apache httpd only and mod_jk, I successfully serve my
>app with apache to a simple 80 http port (cookie path already
>patched). So I decided to have a localhost apache httpd to proxy tomcat
>with AJP. IT works perfectly.

For which particular feature do you need ajp?
I have used several tomcats with httpd with ajp but after some horrible
errors we switched to http connector.
https://tomcat.apache.org/tomcat-9.0-doc/config/http.html

In case you don't need a special feature in httpd this makes also
possible to reduce the complexity of your chain ;-)

nginx (http/https/server static files) -> tomcat

>Now, I need to proxy httpd with nginx, adding SSL with letsencrypt. I
>successfuly configured the proxy and everything works but uploads: if I
>send a file to my app, only small uploads work.
>
>I'd like to investigate the headers, maybe I need to transform some
>string but I'm a completely newbie from this point of view.
>
>Do you have some tips on how to investigate the problem?

With small you mean ~1M, that's the default setup for

client_max_body_size
https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size

>Thanks,
>
>Giacomo Arru

Best regards
Aleks
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

--
Questo messaggio stato analizzato con Libra ESVA ed risultato non infetto.
Seguire il link qui sotto per segnalarlo come spam:
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Aleksandar Lazic
Re: nginx -> httpd -> mod_jk -> tomcat
July 30, 2018 08:20PM
On 30/07/2018 12:44, Giacomo Arru - BETA Technologies wrote:
>Hi Aleksandar, thank you for your reply.
>
>
>> For which particular feature do you need ajp?
>> I have used several tomcats with httpd with ajp but after some
>> horrible errors we switched to http connector.
>
>We wanted to use HTTP Connector, and set it up. But we couldn't manage
>to make the app work correctly: we coudn't upload files > 60k and
>tweaking nginx and tomcat configuration wouldn't help. We were unable
>to debug the problem. With AJP connector, all features work fine. The
>app is developed with Vaadin 8.

Well this sounds weird as ajp and http have a lot common parts in httpd
and tomcat.

I can help you to debug this behaviour if your are willing.

>We have no static files in our app because they already are served with a CDN.
>
>We would like test nginx with AJP connector (if somehow supported!).

Well there is one ajp module but I'm not sure how production ready it is.
https://github.com/yaoweibin/nginx_ajp_module

>client_max_body_size is set to 128m

What's the message in the error log when the upload stops/breaks?

Could you get a debug log?
https://nginx.org/en/docs/debugging_log.html

>so I think the problem occurs at http level while uploading files but I
>can't manage to debug my system.

As we don't know anything about you system it will help a lot to get
some infos about your setup.

Versions + configs:

OS:
tomcat:
httpd:
nginx:
Environment : azure, google, aws, bare metal, .... ?

>Giacomo

Best regards
Aleks

PS: If it's OT for the list please let us know, thanks.

>Da: "Aleksandar Lazic" <[email protected]>
>A: "nginx" <[email protected]>
>Inviato: Sabato, 28 luglio 2018 18:41:59
>Oggetto: Re: nginx -> httpd -> mod_jk -> tomcat
>
>Hi.
>
>On 26/07/2018 10:06, Giacomo Arru - BETA Technologies wrote:
>>Hi everybody,
>>
>>I recently begun using proxy with nginx (same tests were made with
>>haproxy).
>
>Which one do you prefer as both are very good and have similar features.
>
>>My needs are to proxy for failover and balancing tomcat: I need to
>>serve lots of users with production app.
>>
>>While I understood that a 100% tomcat AJP1.3 compatibility is
>>achievable with apache httpd only and mod_jk, I successfully serve my
>>app with apache to a simple 80 http port (cookie path already
>>patched). So I decided to have a localhost apache httpd to proxy tomcat
>>with AJP. IT works perfectly.
>
>For which particular feature do you need ajp?
>I have used several tomcats with httpd with ajp but after some horrible
>errors we switched to http connector.
>https://tomcat.apache.org/tomcat-9.0-doc/config/http.html
>
>In case you don't need a special feature in httpd this makes also
>possible to reduce the complexity of your chain ;-)
>
>nginx (http/https/server static files) -> tomcat
>
>>Now, I need to proxy httpd with nginx, adding SSL with letsencrypt. I
>>successfuly configured the proxy and everything works but uploads: if I
>>send a file to my app, only small uploads work.
>>
>>I'd like to investigate the headers, maybe I need to transform some
>>string but I'm a completely newbie from this point of view.
>>
>>Do you have some tips on how to investigate the problem?
>
>With small you mean ~1M, that's the default setup for
>
>client_max_body_size
>https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
>
>>Thanks,
>>
>>Giacomo Arru
>
>Best regards
>Aleks
>_______________________________________________
>nginx mailing list
>[email protected]
>http://mailman.nginx.org/mailman/listinfo/nginx
>
>--
>Questo messaggio stato analizzato con Libra ESVA ed risultato non infetto.
>Seguire il link qui sotto per segnalarlo come spam:

>_______________________________________________
>nginx mailing list
>[email protected]
>http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login