[GH-ISSUE #342] Problem while configuring cloudbeaver with nginx #92

Closed
opened 2026-03-07 20:44:40 +03:00 by kerem · 7 comments
Owner

Originally created by @padas2 on GitHub (Apr 6, 2021).
Original GitHub issue: https://github.com/dbeaver/cloudbeaver/issues/342

First of all, great work in building this web version of DBeaver. Simply terrific.

I am running CloudBeaver as a docker container in an Amazon EC2 instance.

I am able to access the Cloudbeaver service over the exposed port of the docker container. In this case, it is a random port.
The service is working fine as expected.

The actual problem comes when I am trying to access CloudBeaver from an Nginx (which is running inside the EC2 instance).
Also, there are other services which are load balanced using this Nginx Server.

I have provided a custom config for routing requests to CloudBeaver service but the web client simply says that Error in processing request.

I am attaching the config file. Could you please tell me what am i missing here ?
cloudbeaver.txt

Originally created by @padas2 on GitHub (Apr 6, 2021). Original GitHub issue: https://github.com/dbeaver/cloudbeaver/issues/342 First of all, great work in building this web version of DBeaver. Simply terrific. I am running CloudBeaver as a docker container in an Amazon EC2 instance. I am able to access the Cloudbeaver service over the exposed port of the docker container. In this case, it is a random port. The service is working fine as expected. The actual problem comes when I am trying to access CloudBeaver from an Nginx (which is running inside the EC2 instance). Also, there are other services which are load balanced using this Nginx Server. I have provided a custom config for routing requests to CloudBeaver service but the web client simply says that Error in processing request. I am attaching the config file. Could you please tell me what am i missing here ? [cloudbeaver.txt](https://github.com/dbeaver/cloudbeaver/files/6264354/cloudbeaver.txt)
kerem 2026-03-07 20:44:40 +03:00
Author
Owner

@serge-rider commented on GitHub (Apr 27, 2021):

Generally nginx works fine with cloudbeaver.

Can you connect directly to cloudbeaver http port (e.g. with curl)?
Could you write the error message (in nginx log)?

<!-- gh-comment-id:827666858 --> @serge-rider commented on GitHub (Apr 27, 2021): Generally nginx works fine with cloudbeaver. Can you connect directly to cloudbeaver http port (e.g. with curl)? Could you write the error message (in nginx log)?
Author
Owner

@padas2 commented on GitHub (Jun 6, 2021):

Apologies for the late replay.

The thing is that I am trying to access cloudbeaver over a shared nginx server using the /cloudbeaver path.

This is the error I get:


2021/06/06 08:39:09 [error] 17798#0: *1550902 open() "/usr/share/nginx/html/api/gql" failed (2: No such file or directory), client: client, server: _, request: "POST /api/gql HTTP/1.1", host: "hostname, referrer: "https://<hostname>/cloudbeaver"
2021/06/06 08:39:09 [error] 17798#0: *1550902 open() "/usr/share/nginx/html/api/gql" failed (2: No such file or directory), client: client, server: _, request: "POST /api/gql HTTP/1.1", host: "hostname", referrer: "https://hostname/cloudbeaver"
2021/06/06 08:39:13 [error] 17797#0: *1550905 directory index of "/usr/share/nginx/html/" is forbidden, client: client, server: _, request: "GET / HTTP/1.1", host: "host"

I was able to solve this problem by duplicating nginx configuration for 2 routes.
So now,
my nginx.conf looks like this:

location /cloudbeaver/ {
  proxy_pass	   http://localhost:32798/;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Host $http_host;
}

location / {
  proxy_pass	   http://localhost:32798/;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Host $http_host;
}

This approach works but I don’t think this is the right way to go.

<!-- gh-comment-id:855333395 --> @padas2 commented on GitHub (Jun 6, 2021): Apologies for the late replay. The thing is that I am trying to access cloudbeaver over a shared nginx server using the /cloudbeaver path. This is the error I get: ``` 2021/06/06 08:39:09 [error] 17798#0: *1550902 open() "/usr/share/nginx/html/api/gql" failed (2: No such file or directory), client: client, server: _, request: "POST /api/gql HTTP/1.1", host: "hostname, referrer: "https://<hostname>/cloudbeaver" 2021/06/06 08:39:09 [error] 17798#0: *1550902 open() "/usr/share/nginx/html/api/gql" failed (2: No such file or directory), client: client, server: _, request: "POST /api/gql HTTP/1.1", host: "hostname", referrer: "https://hostname/cloudbeaver" 2021/06/06 08:39:13 [error] 17797#0: *1550905 directory index of "/usr/share/nginx/html/" is forbidden, client: client, server: _, request: "GET / HTTP/1.1", host: "host" ``` I was able to solve this problem by duplicating nginx configuration for 2 routes. So now, my nginx.conf looks like this: ``` location /cloudbeaver/ { proxy_pass http://localhost:32798/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; } location / { proxy_pass http://localhost:32798/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; } ``` This approach works but I don’t think this is the right way to go.
Author
Owner

@meb21uk commented on GitHub (Jun 27, 2021):

Hopefully helps.

Replace cloudbeaver as required.

location = /cloubeaver {
return 302 /cloudbeaver/;
}

location = /api/gql {
    return 307 https://<needs URL>/cloudbeaver$request_uri;
}

location /icons/ {
    return 307 https://<needs URL>/cloudbeaver$request_uri;
}

location /cloudbeaver/ {
    proxy_pass  http://<needs pass request>/;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}
<!-- gh-comment-id:869234168 --> @meb21uk commented on GitHub (Jun 27, 2021): Hopefully helps. Replace cloudbeaver as required. location = /cloubeaver { return 302 /cloudbeaver/; } location = /api/gql { return 307 https://<needs URL>/cloudbeaver$request_uri; } location /icons/ { return 307 https://<needs URL>/cloudbeaver$request_uri; } location /cloudbeaver/ { proxy_pass http://<needs pass request>/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; }
Author
Owner

@padas2 commented on GitHub (Jun 30, 2021):

Let me see if this works.

<!-- gh-comment-id:871410321 --> @padas2 commented on GitHub (Jun 30, 2021): Let me see if this works.
Author
Owner

@meb21uk commented on GitHub (Jul 2, 2021):

Hi Padas2,

No requirement to use this obscure config now. See "Editing rootURI breaks docker.cloudbeaver #279" for the changes required for the cloudbeaver config and NGINX location block required to operate with /cloudbeaver.

<!-- gh-comment-id:873117216 --> @meb21uk commented on GitHub (Jul 2, 2021): Hi Padas2, No requirement to use this obscure config now. See "Editing rootURI breaks docker.cloudbeaver #279" for the changes required for the cloudbeaver config and NGINX location block required to operate with /cloudbeaver.
Author
Owner

@kseniiaguzeeva commented on GitHub (Jan 12, 2022):

There is no update in the ticket during the long time. Please feel free to ask to reopen the ticket if it is still actual for you.

<!-- gh-comment-id:1010771010 --> @kseniiaguzeeva commented on GitHub (Jan 12, 2022): There is no update in the ticket during the long time. Please feel free to ask to reopen the ticket if it is still actual for you.
Author
Owner

@juanbits commented on GitHub (Aug 27, 2023):

i have the same problem. im able to connect via http://myhost:port, but no via https://cb.myhost.com (under nginx)

and when i try to reach the container via curl i got:

curl -i 0.0.0.0:myport
curl: (56) Recv failure: Connection reset by peer
<!-- gh-comment-id:1694589261 --> @juanbits commented on GitHub (Aug 27, 2023): i have the same problem. im able to connect via http://myhost:port, but no via https://cb.myhost.com (under nginx) and when i try to reach the container via curl i got: ``` curl -i 0.0.0.0:myport curl: (56) Recv failure: Connection reset by peer ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cloudbeaver#92
No description provided.