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

LNURL QR scan return wrong URI #597

Closed
Darth-Coin opened this issue Apr 17, 2022 · 1 comment
Closed

LNURL QR scan return wrong URI #597

Darth-Coin opened this issue Apr 17, 2022 · 1 comment

Comments

@Darth-Coin
Copy link
Contributor

Darth-Coin commented Apr 17, 2022

Description / environment

Umbrel (behind Tor) v 0.4.15 (no latest LNbits version, I don't know which version).
Added reverse proxy nginx for LNbits app, certificate, port 443 works fine.
Can connect Zeus / BW / Alby, make payments, create invoices and pay them from other wallets OK.
This LNbits instance is even connected to a Wordpress Woocommerce shop (with this plugin) and works just fine.
(sorry I can't dox the real domain name/IP here, yet, I can provide real ones on PM for devs if they want to investigate)

Error behavior

Only when I scan a LNURL (pay or withdraw) QR code from this LNbits, it return this error:

  • scanning with SBW wallet get this error
"error from vendor" 
java.net.ConnectException: 
Failed to connect to lnbits.my-domain.com/<my public IP>:443
  • scanning with Blixt wallet, says network error, no further explanation
  • scanning with Zeus, I get: lnbits.my-domain.com says https://lnbits.my-domain.com/lnurlp/api/v1/lnurl/6 returned error: Network request failed
  • scanning with Bluewallet, says network error

More steps I've done

  • copied the LNURL (clicked the button "copy LNURL") and paste it in any other wallet and paid. Worked just fine
  • copied the LNURL (clicked the button "copy LNURL") and paste it in https://lnurl.fiatjaf.com/codec/. Returned the correct URI https://lnbits.domain.com/lnurlp/api/v1/lnurl/4
  • copied the LNURL (clicked the button "copy LNURL") and paste it in any website for QR code generator, as text or web link and then scanned the QR code with 2-3 wallet apps. The result is java.net.ConnectException: Failed to connect to lnbits.my-domain.com/<my public IP>:443
  • scanned the QR with a normal mobile bar code scanner app, it return the correct LNURL code (not URI)

Additional info

Here is my nginx conf if this can help:

server {
       listen 443 ssl;
       server_name lnbits.my-domain.com;
       access_log /var/log/nginx/reverse-access.log;
       error_log /var/log/nginx/reverse-error.log;

       location / {
                  proxy_pass http://10.21.21.29:3007;
                  proxy_set_header Host $host;
                  proxy_set_header X-Real-IP $remote_addr; # I tried also without this line, same result
                  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                  # proxy_set_header X-Forwarded-Proto $scheme; (I commented this line because was returning an small error testing the conf)
                  proxy_set_header Upgrade $http_upgrade;
                  proxy_set_header Connection ‘upgrade’;
                  proxy_set_header X-Forwarded-Proto https;
                  proxy_http_version 1.1;
       }

       ssl on;
       ssl_certificate /etc/letsencrypt/live/lnbits.my-domain.com/fullchain.pem;
       ssl_certificate_key /etc/letsencrypt/live/lnbits.my-domain.com/privkey.pem;
}
@Darth-Coin
Copy link
Contributor Author

Darth-Coin commented Apr 21, 2022

UPDATE (FIXED)

I found where is the "issue": @talvasconcelos helped me see where I was doing it wrong. He tested from his side and all worked nice.
So I will explain here, so other users that end up in a situation like me, will not bang their heads to the wall anymore.

Recap:

  • my lnbits is running in a Umbrel node, so all Tor
  • I configured reverse-proxy for lnbits app, with domain, IP all necessary, all visible and working from outside my LAN.
  • I used to access my "clearnet" lnbits with a browser using a VPN IP (outside my LAN and different than my lnbits IP)
  • but using my phone with various LN wallets, connected to my local WiFi (same LAN as node), so it was making a loop back to the node and adding that clearnet IP where reverse proxy was redirecting.

Solution

Use mobile phone with a 4G connection (no related with node IP) to scan that QR LNURL and all is OK.
You can't scan the QR generated in the same LAN and suppose to work over internet, is coming back and the NAT is trying to "repair" that URI by adding the IP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant