lnproxy / lnproxy-relay

A minimalist lnproxy relay
GNU General Public License v3.0
91 stars 13 forks source link

API returns "404 page not found" #13

Closed Reckless-Satoshi closed 1 year ago

Reckless-Satoshi commented 1 year ago

Since yesterday the API returns this message on the dev server at lnproxy.org: 404 page not found

lnproxy commented 1 year ago

Thanks for the warning! Should be back up now.

Looks like I introduced a bug while testing in production.. I have a little script that periodically makes api calls to make sure it's working but it was bad and missed the problem. Monitoring is improved now, I should get a notification as soon as something is failing. I'll have to improve my deployment pipeline.

Reckless-Satoshi commented 1 year ago

Thanks for the warning! Should be back up now.

May this be happening again now? Thanks!

lnproxy commented 1 year ago

Seems to be working for me. Can you run a request with curl -v and post the output?

Reckless-Satoshi commented 1 year ago

Seems to be working for me. Can you run a request with curl -v and post the output?

curl -v https://lnproxy.org/api/LNBC315960N1P3CRUSAPP5WT42F4V3....
*   Trying 70.34.196.65:443...
* TCP_NODELAY set
*   Trying 2a05:f480:2000:2b28:5400:4ff:fe23:1f7:443...
* TCP_NODELAY set
* Immediate connect fail for 2a05:f480:2000:2b28:5400:4ff:fe23:1f7: Network is unreachable
* Connected to lnproxy.org (70.34.196.65) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=lnproxy.org
*  start date: Oct 15 02:02:12 2022 GMT
*  expire date: Jan 13 02:02:11 2023 GMT
*  subjectAltName: host "lnproxy.org" matched cert's "lnproxy.org"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
> GET /api/LNBC315960N1P3CRUSAPP5WT42F4V3T2... HTTP/1.1
> Host: lnproxy.org
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
< Access-Control-Allow-Origin: *
< Connection: close
< Content-Length: 19
< Content-Security-Policy: default-src 'none'; style-src 'self'; img-src 'self' blob: data:; base-uri 'none'; form-action 'self'; frame-ancestors 'none'
< Content-Type: text/plain; charset=utf-8
< Date: Sun, 27 Nov 2022 09:24:31 GMT
< Feature-Policy: camera 'none'; microphone 'none'
< Referrer-Policy: no-referrer
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-XSS-Protection: 1; mode=block
< 
404 page not found
* Closing connection 0
* TLSv1.3 (OUT), TLS alert, close notify (256):

It seems /about and /doc are also not displaying on the site.

Reckless-Satoshi commented 1 year ago

Seems to be working for me. Can you run a request with curl -v and post the output?

curl -v https://lnproxy.org/api/LNBC315960N1P3CRUSAPP5WT42F4V3....

Got it! The route is cap sensitive. Invoices that are all cap (many wallets create them this way) have to be converted to lowercase. Otherwise the 404 happens. Do you think this might be it?

lnproxy commented 1 year ago

Yes that was the problem! I added some simple input validation to the api interface (https://github.com/lnproxy/lnproxy-webui/blob/24d291c884a0b60126c1915301f29c893900a155/lnproxy-webui.go#L28) so it should work from now on.