Can you post the config of the nginx file?
That error usually occurs when the browser thinks its connecting with ssl / https but the server is just putting out non https on that port.
Going offline till the morning, but you can probably google it.
-Dave
It is in my first post, but here it is:
server {
listen 5000 ssl http2 default_server;
listen [::]:5000 ssl http2 default_server;
server_name my.awesome.lnbits.site.ddns.net; # ---------> this site name is setup in in noip.com to avoid IP changes, if they happen
ssl_certificate /etc/nginx/ssl/my.awesome.lnbits.site.crt;
ssl_certificate_key /etc/nginx/ssl/my.awesome.lnbits.site.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
location / {
proxy_pass http://localhost:5000/; # ----> directive that sets up the reverse proxy in nginx
}
}
OSError: [Errno 98] Address already in use - This means you ran another service that is listening to the same port.
Secure Connection Failed
An error occurred during a connection to 192.168.1.153:5000. SSL received a record that exceeded the maximum permissible length.
Error code: SSL_ERROR_RX_RECORD_TOO_LONG
The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the web site owners to inform them of this problem.
This means you are trying to connect to an HTTPS site using HTTP protocol (add "https://" at the beginning of the IP address).
Also you should try to get LNBits to listen for HTTPS traffic - you can't just add a certificate to a site and it magically understands HTTPS traffic.
Of course I used
https:// before the IP address.
How would I make LNBits to listen for HTTPS traffic? Change
listen 5000 ssl http2 default_server; to
listen 443 ssl http2 default_server; ??
proxy_pass https://localhost:5000/; # ----> directive that sets up the reverse proxy in nginx
./venv/bin/hypercorn -k trio --bind 0.0.0.0:5000 'lnbits.app:create_app()'
I think your nginx.conf should be:
proxy_pass http://localhost:5000/;
The Hypercorn didn't manage the SSL certs. So your Nginx passing a HTTPS request onto the Hypercorn. Try to change your Nginx conf as I suggested above, lets see if that works.
EDIT:
In addition, my suggestion above would probably work if you access it from my.awesome.lnbits.site.ddns.net. Since you set up the Nginx configuration only as a reverse proxy for that domain.
In another hand, the reason why it works on HTTP but not on HTTPS when you access it from the local network
[192.168.1.153:5000] is because the connection didn't managed by Nginx, it comes from Hypercorn. The Nginx has no configuration for a local connection, thus the error you get is because you are accessing an HTTP site(LNBits) using an HTTPS protocol, and the Hypercorn got no idea about any SSL certs, etc.
This is how I have my
/etc/nginx/conf.d/my.awesome.lnbits.site.ddns.net.confssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name my.awesome.lnbits.site.ddns.net;
ssl_certificate /etc/nginx/ssl/my.awesome.lnbits.site.ddns.net.crt;
ssl_certificate_key /etc/nginx/ssl/my.awesome.lnbits.site.ddns.net.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
location / {
proxy_pass http://localhost:5000;
#root /usr/share/nginx/html;
#index indext.html index.htm;
}
}
However, I get this error when I try to access to
https://my.awesome.lnbits.site.ddns.net:5000An error occurred during a connection to 192.168.1.153:5000. SSL received a record that exceeded the maximum permissible length.
Error code: SSL_ERROR_RX_RECORD_TOO_LONG
The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the web site owners to inform them of this problem.