i am trying the lucee websockets extension and cor...
# lucee
g
i am trying the lucee websockets extension and correctly appied the code, i see the input fields to send the messages but when i see in my logs, i see var wschat = new WebSocket(protocol + document.location.host + endpoint); WebSocket connection to 'wss://website.com/ws/chat/default' failed: anyone know how this could be a problem: here is the code var channel = "#channel#"; - by default, its named as "default" var endpoint = "/ws/chat/" + channel; var protocol = (document.location.protocol == "https:") ? "wss://" : "ws://"; var wschat = new WebSocket(protocol + document.location.host + endpoint);
d
If you're running you're running Lucee behind a HTTP proxy (like Nginx) I know there are some proxy headers you must pass: https://www.nginx.com/blog/websocket-nginx/ If you're not passing the "Upgrade" and "Connection" headers, then the WebSocket connection to Lucee will be broken and will not work correctly.
g
i have to confirm if nginx is being used, i am sure its served on linux, but for nginx, i am not sure, the upgrade and connection need to be added in lucee code or server somewhere if they have
q
It's a directive you need to set in nginx. If you are on a base install of Lucee, there shouldn't be anything you need to do. To test it, you can try to point the endpoint directly to the Tomcat endpoint.
g
That answer was even more confusing I am still trying to figure out the first section
d
It sounds like you're not managing your environment, so I would reach out to the people who are managing your environment and tell them what you're trying to do. They may know exactly what the issue is.
g
You are right I can confirm in 2-3 hours what we have
got ome information, we are running a docker container
and the docker container we have is (ubuntu linux, lucee, apache,tomcat version 9 is used in lucee and lucee version 5.3 )
Anyone?
d
Did you check your Apache configuration to make sure it's set up properly for WebSocket support via a reverse proxy?
g
Ok seems I have to go to Apache and what I should check in there and any documentation which can specify that what I need to do for websockets to work
d
I don't use Apache, so you'll need to do your own research. Hopefully the Nginx information I sent you should help you figure out what might be needed for Apache.
g
i did kind of changes to enable websockets in apache but does it also needs some virtualhost settings because i restarted apache and did not connected to the websockets
in my apache file, i have this :
Copy code
<IfModule mod_proxy.c>
        ProxyPreserveHost On
        ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ <http://127.0.0.1:8888/$1$2>
        ProxyPassMatch ^/(.+\.cfml)(/.*)?$ <http://127.0.0.1:8888/$1$2>
        # optional mappings
        #ProxyPassMatch ^/flex2gateway/(.*)$ <http://127.0.0.1:8888/flex2gateway/$1>
        #ProxyPassMatch ^/messagebroker/(.*)$ <http://127.0.0.1:8888/messagebroker/$1>
        #ProxyPassMatch ^/flashservices/gateway(.*)$ <http://127.0.0.1:8888/flashservices/gateway$1>
        #ProxyPassMatch ^/openamf/gateway/(.*)$ <http://127.0.0.1:8888/openamf/gateway/$1>
        #ProxyPassMatch ^/rest/(.*)$ <http://127.0.0.1:8888/rest/$1>
        ProxyPassReverse / <http://127.0.0.1:8888/>
</IfModule>
i have enabled the proxy using the commands: a2enmod proxy a2enmod proxy_http a2enmod proxy_wstunnel and restarted apache, but still my websockets not working, any idea, i read it how it passes the proxy, but in my cases, proxies are there
i also tried the code in vhosts file
but none got it working
c
Have you checked the updated instructions https://github.com/isapir/lucee-websocket/blob/04efe28860d8253083c7dbdb29a833106b185989/README.md , especially with regard to lucee-server.xml and lucee-web.xml changes? And maybe https://stackoverflow.com/questions/75032962/how-to-proxy-web-requests-to-lucee-tomcat-under-apache will help, wrt SELinux issue. Finally, try connecting ws directly to Tomcat , from server itself. If that works, then you know it’s Apache or some proxy issue
g
@Cage S i tried all the above things except when you mentioned try to connect directly to tomcat, i am not sure what exactly you mean by that, can you explain a little bit more