Project

General

Profile

Application in Apache using httpd

Added by Manuel Villalba 17 days ago

I am trying to set up an httpd application that uses enableUpdates() with an Apache reverse proxy in between. When I connect directly without going through Apache, everything works perfectly.

When I connect through Apache, with one session, it works fine, but when there are multiple sessions, all the sessions that go through Apache are blocked for the duration of the ProxyPass timeout.

I have been testing, and I see the same behavior in the simplechat example , which also uses enableUpdates(). I'm using wt version 4.11.0

I noticed that if I disable enableUpdates, it doesn’t freeze, but my application stops receiving UI updates.

I don’t want to use fcgi because it has caused problems in the past, and I’ve seen that it is now deprecated.

I have also configured the wt_config.xml with:

                <trusted-proxy-config>
                        <original-ip-header>X-Forwarded-For</original-ip-header>
                        <trusted-proxies>
                                <proxy>126.0.0.1/8</proxy>
                                <proxy>::0/128</proxy>
                        </trusted-proxies>

My Apache configuration is as follows:

<Proxy *>
    Require all granted
</Proxy>

ProxyPreserveHost On
ProxyRequests On

ProxyPass / http://127.0.0.1:8080/ timeout=60 nocanon
ProxyPassReverse / http://127.0.0.1:8080/

KeepAlive Off
Timeout 60

Many thanks for your time and assistance


Replies (3)

RE: Application in Apache using httpd - Added by Matthias Van Ceulebroeck 11 days ago

Hello Manuel,

I haven't used Apache for this myself, we always rely on HAProxy.

Now, what I think may be happening in case of enableUpdates is that a single connection remains open longer than Apache likes (and triggers the timeout). I think that by default long polling will wait for two minutes.
In case you are using WebSockets, as to not have connections open and close constantly, you'll need to ensure the singular connection can remain alive for the duration of the whole session.

I personally do NOT see the behavior of the blocked requests in case of multiple sessions. I tested by running the widget gallery locally, and the simplechat example. They both work fine for me.
The only thing I changes from your config is the proxy to run it all locally. Admittedly, since it is the same host, this will likely not cause proxy deviations.

I can only say that perhaps: <proxy>126.0.0.1/8</proxy> ought to be <proxy>127.0.0.1/8</proxy>?

Best,
Matthias

RE: Application in Apache using httpd - Added by Manuel Villalba 11 days ago

Hello Matthias,

Thank you for you answer.

I haven't used Apache for this myself, we always rely on HAProxy.

I can't switch to HAProxy easily because I have other services running with Apache and both would listen on the same ports by default (80 and 443)

Now, what I think may be happening in case of enableUpdates is that a single connection remains open longer than Apache likes (and triggers the timeout). I think that by default long polling will wait for two minutes.

I will try to find an Apache configuration in order to mitigate that.

In case you are using WebSockets

I'm not using WebSockets, I don't know if Wt uses it behind the scenes .

I can only say that perhaps: 126.0.0.1/8 ought to be 127.0.0.1/8?

I will correct that!

If I make any new discoveries I will share them here.

Thank you again.

RE: Application in Apache using httpd - Added by Matthias Van Ceulebroeck 11 days ago

Hello Manuel,

I can't switch to HAProxy easily
Of course, I wasn't implying you should, just saying I often use it. I always hate answers that say "just use this", even though you specifically said you wanted to use another tool.

I'm not using WebSockets, I don't know if Wt uses it behind the scenes .
It will only do so, if it is enabled. The wt_config.xml has a web-sockets configuration option to enable/disable this.

Hopefully you are able to make it work!

Best,
Matthias

    (1-3/3)