• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Websockets not working in Docker

Hey, team, once again, I had to use the same trick these are my steps:

  1. New subdomain -> to your plesk server
  2. Add subdomain to plesk
  3. Install Let's Encrypt
  4. Install Docker Extension
  5. Search for the baserow/baserow image
  6. Add a container
  7. Setup the volume
  8. Run once
  9. Go back to setting
  10. Change to manual port -> You will need this port later
  11. Add a new env
  12. Added BASEROW_PUBLIC_URL variable to settings with value https://subdomain.domain.com
  13. In the domain Apache & nginx Settings disable Proxy mode and click save
  14. Add a new Docker Proxy -> Your subdomain to docker port
  15. After Proxy mode is disabled add the following additional Nginx directives
    Code:
    location ~ ^/(api|ws)/ {        
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_http_version 1.1;
            proxy_set_header Host $host;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_pass http://subdomain.domain.com:your_docker_port_from_step_10;
        }
  16. In my case the location / does not work
  17. Manually edit /system/subdmain.domain.com/conf/nging.conf
    1. Find
      #extension docker begin
      location ~ ^/.* {
    2. Add the following code inside
      Code:
          proxy_set_header Connection 'upgrade';
          proxy_set_header Upgrade $http_upgrade;
          proxy_http_version 1.1;
  18. Save the file
  19. go to tools/services managment and restart nginx
  20. Visit the domain, you now have done:
    • New domain -> custom nginx settings -> docker proxy
    • New certificate
    • New docker container -> custom url env
    • New nginx.conf
  21. If everything is ok you can create your first account the websockets work
 
I just fell victim of the required 2nd step, so just to clarify for other members:
You can, but you'll first have to disable Proxy mode and click the Apply button
Note that this means a 2-step-operation. First disable proxy mode, hit apply. Only after proxy mode is already disabled, the additional /location or /(...) segments can be added. It is not possible disable proxy mode and add the additional directives in the same step.
 
Hey, team, once again, I had to use the same trick these are my steps:
Good read you've got it working. Note however that manually editing the nginx.conf file of a domain is not a good approach as the file will be overwritten when ever settings are changed on the domain. You should be able to add any additional Nginx directives with / location blocks if you disable Proxy mode first.
 
Last edited:
Hey, every docker image has a documentation page. There, I have included the reference of the volume for you.
The names of the fields have changed but the implementation is the same: 1692614215965.png
  • Container (precisely this): /baserow/data/
  • Host (here is your server; please customize the domain): /var/www/vhosts/YOURDOMAINHERE/.volumes/.baserow
What this is doing is the following:
  • The container has some data stored inside the /baserow/data/ folder, so we want to make the data persisted and accessible, so we tell docker to store the data on our server in a folder of our choice.
 
Thanks, finally I use Nocodb rather than baserow, but face the same problem about websocket, the nginx directive you use, can it be applied to nocodb also?
 
Good read you've got it working. Note however that manually editing the nginx.conf file of a domain is not a good approach as the file will be overwritten when ever settings are changed on the domain. You should be able to add any additional Nginx directives with / location blocks if you disable Proxy mode first.

Unfortunately it does not work for me via the additional nginx directives. Only when I edit the file manually the websocket can connect. However, this file is automatically overwritten again after an hour without me having done anything.

Am I doing something wrong?
Proxy Mode is turned of, added the code to the nginx directives and restarted nginx.
 
@Igcorreia, this issue has been discussed in another forum topic, with another user as well.

The solution would to remove the Docker Proxy Rules from the domain in Plesk, and instead add all the needed nginx directives manually to the additional nginx directives in Plesk. That way there is no need to edit the nginx.conf file manually and the directives aren't overwritten on updates.
 
@Igcorreia, this issue has been discussed in another forum topic, with another user as well.

The solution would to remove the Docker Proxy Rules from the domain in Plesk, and instead add all the needed nginx directives manually to the additional nginx directives in Plesk. That way there is no need to edit the nginx.conf file manually and the directives aren't overwritten on updates.
@Igcorreia, to elaborate on me previous post, you should skip/remove step 14 from your list.
 
1. Disable proxy mode.
2. Remove docker proxy
3. Use the following and add YOUR_DOCKER_PORT to the Additional nginx directives

location ~ ^/.* {
proxy_pass http://0.0.0.0:YOUR_DOCKER_PORT;
proxy_set_header Host $host;
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_set_header Connection 'upgrade';
proxy_set_header Upgrade $http_upgrade;
proxy_http_version 1.1;
}
 
Back
Top