Skip to content

fix: add forward headers to LNBits calls for LNURL generation#183

Merged
TaprootFreak merged 1 commit intodevelopfrom
fix/lnbits-lnurl-forward-headers
May 8, 2026
Merged

fix: add forward headers to LNBits calls for LNURL generation#183
TaprootFreak merged 1 commit intodevelopfrom
fix/lnbits-lnurl-forward-headers

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

  • LNBits generates LNURLs from the incoming HTTP request URL. In the Docker setup on dfxdev, internal calls arrive as http://lnbits:5000/... which fails LNURL validation (requires HTTPS or localhost/onion)
  • This breaks user sign-up completely because LNBits crashes when creating the LNURL-pay link
  • Adds LIGHTNING_LNBITS_SITE_URL env var (e.g. https://dev.lightning.space) that injects Host and X-Forwarded-Proto headers into all LNBits HTTP calls
  • When set, LNBits generates valid external LNURLs like https://dev.lightning.space/lnurlp/api/v1/lnurl/cb/{id}

Changes

  • config.ts: add siteUrl config from LIGHTNING_LNBITS_SITE_URL
  • lightning-client.ts: add lnBitsForwardHeaders() helper, wire into httpLnBitsConfig()
  • .env.example: document new env var
  • Includes prettier formatting of lightning-client.ts (was unformatted)

Deployment

After merge, add to Vaultwarden items:

  • LDS DEV: LIGHTNING_LNBITS_SITE_URL=https://dev.lightning.space
  • LDS PRD: LIGHTNING_LNBITS_SITE_URL=https://lightning.space

Test plan

  • Set LIGHTNING_LNBITS_SITE_URL=https://dev.lightning.space in DEV env
  • Deploy to dfxdev
  • Verify POST /v1/auth/sign-up returns 201 with accessToken
  • Verify LNBits logs show no InvalidUrl errors

@TaprootFreak TaprootFreak force-pushed the fix/lnbits-lnurl-forward-headers branch 2 times, most recently from 89cf351 to 748957c Compare May 8, 2026 14:14
LNBits generates LNURLs from the incoming request URL. In the Docker
setup, internal calls arrive as http://lnbits:5000/... which fails
LNURL validation (requires HTTPS or localhost).

Use Config.baseUrl (dev.lightning.space / lightning.space / localhost)
to set Host and X-Forwarded-Proto headers on all LNBits HTTP calls.
@TaprootFreak TaprootFreak force-pushed the fix/lnbits-lnurl-forward-headers branch from 748957c to 9693d5b Compare May 8, 2026 14:21
@TaprootFreak TaprootFreak marked this pull request as ready for review May 8, 2026 14:23
@TaprootFreak TaprootFreak merged commit 0eaf2da into develop May 8, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

1 participant