lnbits: Unsupported upgrade request nginx

Hey there,

I was using lnbits integrated on a raspiblitz before and am now trying to get it to run on a seperate machine. Installation (0.10) went successful and I am able to reach it on 127.0.0.1:5000 (or 0.0.0.0:5000, if configured).

Now I put this machine and my lightning node in a VPS VPN together running nginx. Pointing my domain to the lnbits servers VPN IP gets me an “unsupported upgrade request”.

So I installed nginx to the lnbits machine instead with the following config file:

## lnbits_ssl.conf

server {
    listen 5001 ssl http2;
    listen [::]:5001 ssl http2;
    server_name _;

    access_log /var/log/nginx/access_lnbits.log;
    error_log /var/log/nginx/error_lnbits.log;

    location /static {
        root /home/lnbits/lnbits/lnbits;
    }

    location / {
        proxy_pass http://127.0.0.1:5000;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header Host $host;
        proxy_http_version 1.1; # headers to ensure replies are coming back and forth through your domain

    }
    ssl_certificate /home/lnbits/certs/lnbits-ssl.crt;
    ssl_certificate_key /home/lnbits/certs/lnbits-ssl.key;
}

Same result: Calling 0.0.0.0:5001 gets me an “unsupported upgrade request”

If I comment out proxy_set_header Connection 'upgrade', it works, but with a lot of visual errors

Can anyone help me, please? I am not an nginx expert. Used this conf a lot to reach several services

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

no, legend is running core lightning aswell, this need to be fixed asap

Looks like the static files cannot be loaded. What does the browser show in the network console?

Maybe you find something in my setup that can help, for one I don’t have the /static location and I had a CORS issue with the fonts:

    location / {
        proxy_pass http://127.0.0.1:3007;

        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_http_version 1.1;

        include uwsgi_params;
    }

    location ~* \.(woff2)$ {
        proxy_pass http://127.0.0.1:3007;
        add_header Access-Control-Allow-Origin *;
    }