You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Elias Kopsiaftis <ye...@gmail.com> on 2014/05/12 17:20:21 UTC

Comet Servlet with a reverse proxy in front of it

Is there any way to put a reverse proxy in front of a Comet servlet? I
tried apache but thats a no go because it uses a single thread per
connection, which is not scaleable, then I tried nginx, which perhaps I did
something wrong in my setup but in the client code, the call to
getInputStream never returns, indicating something is wrong. I apologize
for not providing too many details and just proposing a general question,
but Im hoping there is a general solution to this problem. If you guys
needs server specific details I can provide later today when I get home
from work.

Re: Comet Servlet with a reverse proxy in front of it

Posted by Elias Kopsiaftis <ye...@gmail.com>.
Here is my config for using nginx as a reverse proxy in front of tomcat.
Seems to work so far. Just replace the question marks with your
configuration


 server {
        listen 80;
        server_name ??????;
        root /var/lib/tomcat7/webapps/?????.

        location / {
                proxy_http_version 1.1;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_pass http://127.0.0.1:8085/;
        }




On Thu, May 15, 2014 at 1:04 PM, Elias Kopsiaftis <ye...@gmail.com> wrote:

> Hey,
>
> I actually got this working so far with nginx(and by so far I mean the
> random connection errors I was getting with apache2 have not surfaced yet).
>
> Ill post the nginx config setup later today when I get home for the
> benefit of anyone else who wants to do this.
>
>
> On Mon, May 12, 2014 at 3:34 PM, Christopher Schultz <
> chris@christopherschultz.net> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>> Elias,
>>
>> On 5/12/14, 11:20 AM, Elias Kopsiaftis wrote:
>> > Is there any way to put a reverse proxy in front of a Comet
>> > servlet?
>>
>> I don't believe so. There is work being done on supporting Websocket
>> through mod_proxy but it will likely never support Comet.
>>
>> > I tried apache but thats a no go because it uses a single thread
>> > per connection, which is not scaleable
>>
>> Only some Apache httpd MPMs are one-thread-per-connection.
>>
>> > then I tried nginx, which perhaps I did something wrong in my
>> > setup but in the client code, the call to getInputStream never
>> > returns, indicating something is wrong. I apologize for not
>> > providing too many details and just proposing a general question,
>> > but Im hoping there is a general solution to this problem. If you
>> > guys needs server specific details I can provide later today when I
>> > get home from work.
>>
>> I think that httpd + Tomcat is not going to work, here. I'm not sure
>> about Nginx. If you find something that works, please post back with
>> your findings.
>>
>> - -chris
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1
>> Comment: GPGTools - http://gpgtools.org
>> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>>
>> iQIcBAEBCAAGBQJTcSJSAAoJEBzwKT+lPKRYFL8P/jryAJ8epDKL8nioPLV2PAWF
>> 2z2rmNLEtYq4Do+lraq0ttoIhYKkJ0pLyV7/evNDEkjTrtrM2uNEY/BrsVgWelp9
>> q6RqjYKdFhc/rPmTL+Uu2JHMFfpUfNrVGqAmPwqVU6qwzVrlfujF/z/EHxq13Rib
>> IXQgMJcB2yFx7Boeg2BJWLUhbTeod0aR8RjNKQG6EhiQghnATb6FpKEjHvYkJXCt
>> SGr0NptEM2xVlqTfbsuBDf/ZJQS+bh9h89c0nqZPkuYWkH5ZGbq02am8e4nJOVhl
>> tU3lUQCT5+3wNlXeGVuFdoOlFxl9IJGRU7sx+Sjku2eIXRDTXYvQ3sH4wgjxIomV
>> qwrcN5aBnW/l5slPaXcxA6NNcxcjfOyoCBs+oLzWDA8B1ijh4JY2SsMVrUSSXDVr
>> F4JIVrR+19nXJnFiBVKboU5nN54mzIo3OtKNeI3/dnITXdRX1gft5jmWaI4n59Ci
>> yodCN5l35R9uFurSYWmVPyYv8Bk+aOFgYjqLPJU6d7So3g/fVx8cWubAqzj9Ft8V
>> IYRBUCn/rsDW2nRXJX/vlmgKwsgrDI2rlorIdcRYmj+PCOBykuBsHpVk29Te1Cxy
>> eOh7V05X7VOXzqWnOm2zO43PwCPc98g0eDlB4/l/VDyE/VZ4IXcQifa1f6vZutOH
>> 8mzvN7jAkrMBvsGk48kr
>> =+J8x
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>

Re: Comet Servlet with a reverse proxy in front of it

Posted by Elias Kopsiaftis <ye...@gmail.com>.
Hey,

I actually got this working so far with nginx(and by so far I mean the
random connection errors I was getting with apache2 have not surfaced yet).

Ill post the nginx config setup later today when I get home for the benefit
of anyone else who wants to do this.


On Mon, May 12, 2014 at 3:34 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Elias,
>
> On 5/12/14, 11:20 AM, Elias Kopsiaftis wrote:
> > Is there any way to put a reverse proxy in front of a Comet
> > servlet?
>
> I don't believe so. There is work being done on supporting Websocket
> through mod_proxy but it will likely never support Comet.
>
> > I tried apache but thats a no go because it uses a single thread
> > per connection, which is not scaleable
>
> Only some Apache httpd MPMs are one-thread-per-connection.
>
> > then I tried nginx, which perhaps I did something wrong in my
> > setup but in the client code, the call to getInputStream never
> > returns, indicating something is wrong. I apologize for not
> > providing too many details and just proposing a general question,
> > but Im hoping there is a general solution to this problem. If you
> > guys needs server specific details I can provide later today when I
> > get home from work.
>
> I think that httpd + Tomcat is not going to work, here. I'm not sure
> about Nginx. If you find something that works, please post back with
> your findings.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJTcSJSAAoJEBzwKT+lPKRYFL8P/jryAJ8epDKL8nioPLV2PAWF
> 2z2rmNLEtYq4Do+lraq0ttoIhYKkJ0pLyV7/evNDEkjTrtrM2uNEY/BrsVgWelp9
> q6RqjYKdFhc/rPmTL+Uu2JHMFfpUfNrVGqAmPwqVU6qwzVrlfujF/z/EHxq13Rib
> IXQgMJcB2yFx7Boeg2BJWLUhbTeod0aR8RjNKQG6EhiQghnATb6FpKEjHvYkJXCt
> SGr0NptEM2xVlqTfbsuBDf/ZJQS+bh9h89c0nqZPkuYWkH5ZGbq02am8e4nJOVhl
> tU3lUQCT5+3wNlXeGVuFdoOlFxl9IJGRU7sx+Sjku2eIXRDTXYvQ3sH4wgjxIomV
> qwrcN5aBnW/l5slPaXcxA6NNcxcjfOyoCBs+oLzWDA8B1ijh4JY2SsMVrUSSXDVr
> F4JIVrR+19nXJnFiBVKboU5nN54mzIo3OtKNeI3/dnITXdRX1gft5jmWaI4n59Ci
> yodCN5l35R9uFurSYWmVPyYv8Bk+aOFgYjqLPJU6d7So3g/fVx8cWubAqzj9Ft8V
> IYRBUCn/rsDW2nRXJX/vlmgKwsgrDI2rlorIdcRYmj+PCOBykuBsHpVk29Te1Cxy
> eOh7V05X7VOXzqWnOm2zO43PwCPc98g0eDlB4/l/VDyE/VZ4IXcQifa1f6vZutOH
> 8mzvN7jAkrMBvsGk48kr
> =+J8x
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Comet Servlet with a reverse proxy in front of it

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Elias,

On 5/12/14, 11:20 AM, Elias Kopsiaftis wrote:
> Is there any way to put a reverse proxy in front of a Comet
> servlet?

I don't believe so. There is work being done on supporting Websocket
through mod_proxy but it will likely never support Comet.

> I tried apache but thats a no go because it uses a single thread
> per connection, which is not scaleable

Only some Apache httpd MPMs are one-thread-per-connection.

> then I tried nginx, which perhaps I did something wrong in my
> setup but in the client code, the call to getInputStream never
> returns, indicating something is wrong. I apologize for not
> providing too many details and just proposing a general question,
> but Im hoping there is a general solution to this problem. If you
> guys needs server specific details I can provide later today when I
> get home from work.

I think that httpd + Tomcat is not going to work, here. I'm not sure
about Nginx. If you find something that works, please post back with
your findings.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTcSJSAAoJEBzwKT+lPKRYFL8P/jryAJ8epDKL8nioPLV2PAWF
2z2rmNLEtYq4Do+lraq0ttoIhYKkJ0pLyV7/evNDEkjTrtrM2uNEY/BrsVgWelp9
q6RqjYKdFhc/rPmTL+Uu2JHMFfpUfNrVGqAmPwqVU6qwzVrlfujF/z/EHxq13Rib
IXQgMJcB2yFx7Boeg2BJWLUhbTeod0aR8RjNKQG6EhiQghnATb6FpKEjHvYkJXCt
SGr0NptEM2xVlqTfbsuBDf/ZJQS+bh9h89c0nqZPkuYWkH5ZGbq02am8e4nJOVhl
tU3lUQCT5+3wNlXeGVuFdoOlFxl9IJGRU7sx+Sjku2eIXRDTXYvQ3sH4wgjxIomV
qwrcN5aBnW/l5slPaXcxA6NNcxcjfOyoCBs+oLzWDA8B1ijh4JY2SsMVrUSSXDVr
F4JIVrR+19nXJnFiBVKboU5nN54mzIo3OtKNeI3/dnITXdRX1gft5jmWaI4n59Ci
yodCN5l35R9uFurSYWmVPyYv8Bk+aOFgYjqLPJU6d7So3g/fVx8cWubAqzj9Ft8V
IYRBUCn/rsDW2nRXJX/vlmgKwsgrDI2rlorIdcRYmj+PCOBykuBsHpVk29Te1Cxy
eOh7V05X7VOXzqWnOm2zO43PwCPc98g0eDlB4/l/VDyE/VZ4IXcQifa1f6vZutOH
8mzvN7jAkrMBvsGk48kr
=+J8x
-----END PGP SIGNATURE-----

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