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

Unable to load when reverse proxy is configured with a location other than root #1025

Open
pabpas opened this issue Jan 26, 2025 · 11 comments
Open

Comments

@pabpas
Copy link

pabpas commented Jan 26, 2025

First time trying Alby Hub and I noticed that if I serve it (with nginx) to the outside in mydomain.com/alby, the browser will show an error about malformed jwt and the main page will not load. Setting the location to / solves the issue (mydomain.com/).

@rolznz
Copy link
Contributor

rolznz commented Jan 27, 2025

Hi, yeah unfortunately I don't think it will work not on the root. alby.mydomain.com would work if you are ok with adding another DNS entry

@daum3ns
Copy link

daum3ns commented Feb 23, 2025

i am confused because my redirect removes the URI. This is also visible in the AlbyHub logs

{"host":"removed","level":"info","msg":"handled API request","remote_ip":"xx.xx.xx.xx","request_id":"wfkXCdKaybzbrkeZKxviGvMBrPjDpqAw","status":200,"time":"2025-02-23T11:58:28Z","uri":"/","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:135.0) Gecko/20100101 Firefox/135.0"}

as you can see the URI is /, the status code is 200, but the page is just blank.. No indication of an error in the logs..
when i do a request to the /api i get the same "missing or malformed jwt"" error as pabpas

@rolznz
Copy link
Contributor

rolznz commented Feb 24, 2025

Hi, what version are you running? did you start/unlock Alby Hub?

@daum3ns
Copy link

daum3ns commented Feb 26, 2025

HI
I use the latest version from github (v1.14.3). No I just started the binary and wanted to access the site but only see a white page. However, i just realized that, when I make a call to the correct port und using plain HTTP (i.e without going through the proxy) i can see the page.
Do you think i need to go through a set up process of some kind before it can work (i'm new to albyhub)?

@rolznz
Copy link
Contributor

rolznz commented Feb 27, 2025

@daum3ns what error code do you get on the white page? did you setup the proxy correctly for https and correctly configure your subdomain?

@daum3ns
Copy link

daum3ns commented Mar 1, 2025

let me try to explain better :) my idea was that the reverse proxy (nginx) terminates the tls connection.
i have the following start script for albyhub:

#!/bin/bash

WORK_DIR="/mnt/opt/albyhub/data" LOG_EVENTS=true LDK_GOSSIP_SOURCE="" PORT="8029" LN_BACKEND_TYPE=LND LND_ADDRESS=127.0.0.1:10019 LND_CERT_FILE=<path_to_cert> LND_MACAROON_FILE=<path_to_macaroon> /mnt/opt/albyhub/bin/albyhub

and in the nginx configuration i have defined a backend :

upstream albyhub {
  server 127.0.0.1:8029;
}

and a proxypass directive, to route everything under /albyhub/ to the backend:

  location ^~ /albyhub/ {
    proxy_pass http://albyhub/;
  }

this results in a 200 on first request, but then a bunch of 502's
Image

in comparison, when i browse the port directly (and without https) it seems to work:

Image

I can't do this via subdomain unfortunately...

@daum3ns
Copy link

daum3ns commented Mar 1, 2025

i think i just figured it out... if i make a call to the .js file (which fails to load in screenshot 1) manually, and add the /albyhub/ path in front, i can fetch it....

Image

so albyhub responds with "please load the file from /" but this should be translated to "please load /albyhub/" in my case... i will check if i can achieve this in nginx proxy...

@daum3ns
Copy link

daum3ns commented Mar 1, 2025

seems to be hard to solve this in nginx... i would have to rewrite the responses from albyhub to include the path prefix...

i tried setting both BASE_URL and FRONTEND_URL env vars, but from what i can tell from looking at the code this is only used for oauth redirects...

a setting like PATH_PREFIX or something would be really nice, if it is set, albyhub just always puts it in front of the uri...

could this be added in this line here?

or could it be done like this?
labstack/echo#2435 (comment)
maybe somewhere here:

e := echo.New()

@rolznz
Copy link
Contributor

rolznz commented Mar 2, 2025

@daum3ns I think several changes need to be made to make it work properly and a bit more complex configuration, which I would try to avoid unless really necessary. Just to understand better, why can't you use a subdomain?

@daum3ns
Copy link

daum3ns commented Mar 4, 2025

I am working on the integration of albyhub for the NODL (https://www.nodl.eu/)
at the moment I am developing this in a cloud instance. I don't have access to the DNS entries there, customers get their subdomain and can then access there cloud nodl..
However, in the end it should run on the devices, they are at home and there is no external access.. (except via tor)
How do other nodes do this?
Maybe I can do it by going on a different port (front facing) instead of sub path...

@rolznz
Copy link
Contributor

rolznz commented Mar 4, 2025

@daum3ns for self-hosting, Start9 and Umbrel give different .local addresses too.

For nodl cloud using a different port could be good to try, since it wouldn't require any changes on Alby Hub's end. But please let me know if that doesn't work for you.

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

3 participants