Cuba app not working with AWS load balancer url

Hi Team,

We have hosted our cuba application on AWS server and we are able to access the app with IP address like
Something like for example:
http://18.101.10.10/app

We have also setup load balancer for this and when we are trying to access the app with load balancer url
Some thing like(just for reference its dummy url)
http://myapp-elasticl-5675757676-3543535545.us-east-1.elb.amazonaws.com/app/#!

app is giving error
Error - IllegalStateException: A filter or servlet of the current chain does not support asynchronous operations.
imageerror details.txt (3.4 KB)

image

Please help

Hi,

Which balancer do you use? Please note that you need sticky sessions support on load balancer for CUBA Web Client. Most probably, you need ALB with sticky sessions setup. Also, try to switch PUSH connection to long polling as described here: Appendix B: Application Properties - CUBA Platform. Developer’s Manual

@artamonov currently we are using CLB(classic load balancer) and now we are going to switch to ALB(Application load balancer) as per user comments above.

and also we are going to add the properties

cuba.web.pushEnabled = "true"
cuba.web.pushLongPolling="true"
cuba.web.pushLongPollingSuspendTimeoutMs = 600000   (10 minutes)

please tell us where we need to add these properties? which location? and which file need to be modified?

please let us know is every thing is correct here or any changes needed.

Is this correct? @artamonov

image

Yes,

It is the options of web application, in the description of a property you can find:

Used in Web Client.

This means that the property should be specified in web-app.properties file.

1 Like

I added these properties in local host(http://localhost:8080/app/#!) and trying to run and now i am getting the same error which i was getting in server for load balancer url.

image

cuba.web.pushEnabled = true
cuba.web.pushLongPolling = true
cuba.web.pushLongPollingSuspendTimeoutMs = 600000

Can I test these in changes in localhost or not ? Or we need to test only in load balancer url

It seems that you have added filter or servlet to your web.xml and have not added <async-supported>true</async-supported>. Please check your web.xml file.

@artamonov

<async-supported>true</async-supported> is already present.

please find the attached and let us know do we need to make any changes
file path : \modules\web\web\WEB-INF

web.xml (4.0 KB)

Also, if you use Nginx as proxy you will need to setup its properties as shown in Server Push Settings - CUBA Platform. Developer’s Manual

@artamonov is this web.xml correct?

@artamonov where do we add this Nginx web server settings for using WebSocket

what should be the steps to add these settings

If you do not use Nginx these settings are not required.

Unfortunately, I cannot say what is wrong because of lack of details and context. Previously, we successfully deployed our applications to AWS and we do not have such a problem with proxy / websocket config.

As I see from your web.xml there is no async-supported for cuba_filter:

It should be:

    <filter>
        <filter-name>cuba_filter</filter-name>
        <filter-class>com.haulmont.cuba.web.sys.CubaHttpFilter</filter-class>
        <async-supported>true</async-supported>
    </filter>

All the filters must have <async-supported>true</async-supported>.

@artamonov thanks so much… after adding these above changes now the app is working fine.