toolkit icon indicating copy to clipboard operation
toolkit copied to clipboard

Receiving "Unable to connect, please view the connection problems guide to fix the issue."

Open iliaskasm opened this issue 3 years ago • 5 comments

Steps to Reproduce

Greetings,

I have recently installed Overleaf Toolkit on my Debian 11 server with TLS support. Everything works fine, except for when visiting a document URL. Then I get the following message:

image

However, after 10 seconds, the document is loaded perfectly.

The steps I followed are the ones from Quick start guide:

  1. Executed git clone https://github.com/overleaf/toolkit.git ./overleaf
  2. Executed cd overleaf
  3. Executed bin/init
  4. Executed bin/init --tls
  5. Edited config/overleaf.rc as follows:
#### Overleaf RC ####

PROJECT_NAME=overleaf

# Sharelatex container
SHARELATEX_DATA_PATH=data/sharelatex
SERVER_PRO=false
SHARELATEX_LISTEN_IP=127.0.0.1
SHARELATEX_PORT=7745

# Sibling Containers
SIBLING_CONTAINERS_ENABLED=false
DOCKER_SOCKET_PATH=/var/run/docker.sock

# Mongo configuration
MONGO_ENABLED=true
MONGO_DATA_PATH=data/mongo

# Redis configuration
REDIS_ENABLED=true
REDIS_DATA_PATH=data/redis

# TLS proxy configuration (optional)
# See documentation in doc/tls-proxy.md
NGINX_ENABLED=true
NGINX_CONFIG_PATH=config/nginx/nginx.conf
NGINX_HTTP_PORT=7746
# Replace these IP addresses with the external IP address of your host
NGINX_HTTP_LISTEN_IP=192.168.1.1
NGINX_TLS_LISTEN_IP=0.0.0.0
TLS_PRIVATE_KEY_PATH=config/nginx/certs/overleaf_key.pem
TLS_CERTIFICATE_PATH=config/nginx/certs/overleaf_certificate.pem
TLS_PORT=7744
  1. Uncommented the following lines in overleaf/variables.env:
SHARELATEX_BEHIND_PROXY=true
SHARELATEX_SECURE_COOKIE=true
  1. Edited overleaf/nginx/nginx.conf as follows:
events {}

http {

    server {
        listen 80 default_server;
        server_name _;
        return 301 https://$host$request_uri;
    }


    server {
        listen 443 ssl;

        ssl_certificate      /certs/nginx_certificate.pem;
        ssl_certificate_key  /certs/nginx_key.pem;

        ssl_protocols               TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers   on;

        # used cloudflares ciphers https://github.com/cloudflare/sslconfig/blob/master/conf
        ssl_ciphers                 EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;

        # config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
        # to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping
        add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";

        server_tokens off;

        client_max_body_size 50M;

        location / {
            proxy_pass http://sharelatex:80; # The port must match the value of SHARELATEX_PORT.
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_read_timeout 3m;
            proxy_send_timeout 3m;
        }
    }
}

(yes, I use http://sharelatex:80 in proxy_pass because using the SHARELATEX_PORT didn't work. I also tried many other combinations...)

  1. Executed bin/up

It is really strange that I get this error only on my desktop (Windows) with Chrome and only when accessing the server remotely. When accessing through Firefox or through my mobile phone (Chrome), the error disappears. Please also note that the server is behind a software firewall (iptables) that blocks all remote connections (except for the ports used by ShareLaTeX) and forwards the WAN ports to 192.168.1.1.

Thank you in advance.

Ilias

iliaskasm avatar Mar 16 '22 22:03 iliaskasm

Have you managed to solve it? I'm having the exact same problem.

bombaglad avatar Mar 10 '23 05:03 bombaglad

same problem

mileswangs avatar May 08 '23 00:05 mileswangs

This error occurs in ubuntu 22.04, but overleaf works fine in windows and fedora.

mileswangs avatar May 08 '23 01:05 mileswangs

I have the same problem with ubuntu 22.04

shl518 avatar Jun 20 '23 14:06 shl518

fine , I ask gpt4 ,it give me a good answer: In nginx.conf, especially in the location block ,I forgot to add these cmmand: location / { ....... proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; }

shl518 avatar Jun 20 '23 14:06 shl518