Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem while configuring cloudbeaver with nginx #342

Closed
padas2 opened this issue Apr 6, 2021 · 7 comments
Closed

Problem while configuring cloudbeaver with nginx #342

padas2 opened this issue Apr 6, 2021 · 7 comments
Labels
development question Further information is requested

Comments

@padas2
Copy link

padas2 commented Apr 6, 2021

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

@padas2 padas2 added question Further information is requested wait for review labels Apr 6, 2021
@serge-rider
Copy link
Member

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)?

@padas2
Copy link
Author

padas2 commented 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.

@meb21uk
Copy link

meb21uk commented 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";
}

@padas2
Copy link
Author

padas2 commented Jun 30, 2021

Let me see if this works.

@meb21uk
Copy link

meb21uk commented 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.

@kseniiaguzeeva
Copy link
Contributor

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.

@juanbits
Copy link

juanbits commented 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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants