OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums Forums OroCommerce How to configure NGINX for WebSocket

This topic contains 7 replies, has 3 voices, and was last updated by  mmiasnikov 6 years, 5 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #32379

    zhex900
    Participant

    Hi,

    I have failed to configure my nginx to serve websocket. Please have a look at my configuration files. Let me know what I should change.

    My port 8080 is open

    This is the javascript error:

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #32380

    jderdziak
    Participant

    Hello zhex900,

    Please see this article for detailed nginx configuration:

    https://www.nginx.com/blog/websocket-nginx/

    Also try to run:

    To see if there is no error messages there.

    Regards
    Jakub

    #32381

    zhex900
    Participant

    Hi tried to follow this blog. But I struggle to fully understand it.

    I tried to add this to my port 443 server block. But this gives a http status 400 error. What location should I use?

    #32382

    mmiasnikov
    Participant

    Hello, zhex900.

    As far as you use secure (WSS) connection, you need to

    1) configure reverse proxy before clank server, that will transfer WSS inbound traffic to unsecure local Clank server, namely:

    2) correctly route websocket_frontend_… parameters to this reverse proxy URL:

    Actually, there is developer manual for your case How to configure WSS connection

    Please, let me know if you still have any questions.

    #32383

    zhex900
    Participant

    I think I fixed it!

    I have added this to my http block. The error is gone. How do I check if the websocket is working?

    #32384

    mmiasnikov
    Participant

    Example of test case:

    Scenario: Maintenance mode notifications

    1) Install OpoPlatform application and configure websockets connection

    2) Login as admin (or any other backend user) and go to any admin area page

    3) Switch on maintenance mode (by type command app/console lexik:maintenance:lock in server console)

    4) On opened in browser OroPlatform admin page must appear flash message with notification

    Maintenance mode
    The website is currently down for maintenance and cannot respond to your request. It should be back online shortly, please try to re-access in a few minutes.
    Sorry for the inconvenience. If you need more information please contact your Administrator.

    5) Switch off maintenance mode (by type command app/console lexik:maintenance:unlock in server console)

    6) Maintenance notification message must disappear.

    But I think it won’t work, because in your case (and as usual) ‘websocket_bind_port’ and ‘websocket_backend_port’ should be the same (websocket_bind_address – it’s where is running Clank server. websocket_backend_… params – it’s where PHP server application send (publish) and receive data. websocket_frontend_… params – it’s where JS client (site) application send and receive data).

    #32385

    zhex900
    Participant

    This is a message I get when I turn on maintenance mode. I don’t think this a flash message. I have also change made the websocket_bind_port and websocket_backend_port the same port. Port 8080.

    Is this the correct maintenance notification message?

    Screen_Shot_2017_11_29_at_8_14_32_am

    #32386

    mmiasnikov
    Participant

    No, should be exactly flash message – it’s the sense of real-time comet (websocket) connection.

    If you set websocket_frontend_port: 3088, then you should configure this port (3088) in your NGINX config to receive SSL requests and then proxy these SSL requests in background to your clank server on 8080 port.

    Something like this:

Viewing 7 replies - 1 through 7 (of 7 total)

The forum ‘OroCommerce’ is closed to new topics and replies.

Back to top