airdcpp-web / airdcpp-webclient

Communal peer-to-peer file sharing application for file servers/NAS devices
https://airdcpp-web.github.io
171 stars 31 forks source link

Web UI connection problem to the application under docker nginxproxymanager #415

Closed denppa closed 2 years ago

denppa commented 2 years ago

I am running airdc with the portable binary and then reverse proxying it using nginxproxymanager which is a docker container. https://github.com/jc21/nginx-proxy-manager

The problem seems to be that, since the RP is a container, it is forwarding traffic from the container's internal ip to the server's bridge, and during that process the web UI cannot connect to the app. Instead hanging in this screen: https://i.imgur.com/yKCZncB.png

Do you think this is a header/host forwarding error or something else? Any ideas would be welcomed.

peps1 commented 2 years ago

Can you show your nginx config? Can the nginx container itself reach the airdc ui? Make sure you're using the correct protocol, best try with http first, so enable plain http on the airdc ui and have nginx use http to talk to airdc.

denppa commented 2 years ago

Can you show your nginx config? Can the nginx container itself reach the airdc ui? Make sure you're using the correct protocol, best try with http first, so enable plain http on the airdc ui and have nginx use http to talk to airdc.

Yes, nginx config:

server {
  set $forward_scheme http;
  set $server         "172.17.0.1";
  set $port           5600;

  listen 80;
listen [::]:80;

listen 443 ssl http2;
listen [::]:443 ssl http2;

  server_name airdc.example.com;

  # Let's Encrypt SSL
  include conf.d/include/letsencrypt-acme-challenge.conf;
  include conf.d/include/ssl-ciphers.conf;
  ssl_certificate /etc/letsencrypt/live/npm-2/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/npm-2/privkey.pem;

# Asset Caching
  include conf.d/include/assets.conf;

  # Block Exploits
  include conf.d/include/block-exploits.conf;

  # HSTS (ngx_http_headers_module is required) (63072000 seconds = 2 years)
  add_header Strict-Transport-Security "max-age=63072000;includeSubDomains; preload" always;

    # Force SSL
    include conf.d/include/force-ssl.conf;

  access_log /data/logs/proxy-host-9_access.log proxy;
  error_log /data/logs/proxy-host-9_error.log warn;

  location / {

  # HSTS (ngx_http_headers_module is required) (63072000 seconds = 2 years)
  add_header Strict-Transport-Security "max-age=63072000;includeSubDomains; preload" always;

    # Proxy!
    include conf.d/include/proxy.conf;
  }

  # Custom
  include /data/nginx/custom/server_proxy[.]conf;
}

I would like to say it can reach the UI and UI itself only, since it was loading on the connecting to server screen complete with the background image I custom set.

As you can see the proxy forwarding does happen with http://172.0.0.1:5600 The backend for some reason is not connecting. If I open up the firewall and then type in the IP and port, it works just fine.

maksis commented 2 years ago

Have you checked out https://github.com/airdcpp-web/airdcpp-webclient/wiki/nginx-proxy-configuration ?

denppa commented 2 years ago

Have you checked out https://github.com/airdcpp-web/airdcpp-webclient/wiki/nginx-proxy-configuration ?

I did, and started used the info there to start a thread over the npm creator.

Got a reply from the creator of nginxproxymanager here at this issue thread: https://github.com/jc21/nginx-proxy-manager/issues/1556

And in there, I found out enabling the so called web socket, which adds these lines to the config:

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

Made the app work instantly.

So for future people looking to use docker nginxproxymanager with airdcpp, please note that you do need to enable the websocket support when creating the proxy host.