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

Fixes #33 Mostly working version of baseURL #518

Closed
wants to merge 1 commit into from

Conversation

ktaragorn
Copy link
Contributor

Issues-

  • Pocketbase doesnt autologin
  • maybe related, public key is empty.
  • baseURL has to be configured at build time, and I couldnt get a build env to work.

Issues-
- Pocketbase doesnt autologin
- maybe related, public key is empty.
- baseURL has to be configured at build time, and I couldnt get a build env to work.
@ktaragorn
Copy link
Contributor Author

Main issue is the 3rd one, seems like Base url needs to be configured at build time, rather than run time. vitejs/vite#15674

I tested this with this nginx conf, and i didnt test alerts, but i think most of everything else worked.


user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    # include /etc/nginx/conf.d/*.conf;
    server {
        listen 80;
        root /var/www/html;
        location /xyz/{
            proxy_set_header Host      $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
            rewrite ^/xyz/(.*) /$1 break;
            proxy_pass http://172.31.121.113:8090/;
            proxy_redirect default;
        }
    }
}

I am a light user though, maybe my definition of "everything" isnt complete :D

@ktaragorn
Copy link
Contributor Author

TODO

  • Test with base URL /
  • Try to get pocketbase login and ssh key working

@henrygd
Copy link
Owner

henrygd commented Feb 1, 2025

Thanks, I've also been working on this.

I have it so you can pass in an env var like BESZEL_URL at runtime and it will parse the subpath from that.

I've got it working for the most part, but it requires setting up the path with your proxy like you outlined above.

If I can figure out a way to change the PocketBase admin path to use the subpath then we can do this without needing additional proxy configuration, but I'm not sure there's a way to do this yet.

In any case this will definitely be in the next release.

@ktaragorn
Copy link
Contributor Author

Cool, am curious to see how you got it working. Pocketbase seems to prefer the rewrite, as it is in their reverse proxy docs and I saw a question get answered that way as well.

@henrygd
Copy link
Owner

henrygd commented Feb 2, 2025

I made a branch with my changes here: https://github.com/henrygd/beszel/tree/base-path

Seems to work pretty well with APP_URL=http://beszel.localhost/xyz and a proxy configured for /xyz, but I need to do a bit more testing.

I'd also like to get it working in dev mode if possible.

@henrygd
Copy link
Owner

henrygd commented Feb 5, 2025

I merged my changes and added you as a coauthor to give you credit for the work you did on this 👍

@henrygd henrygd closed this Feb 5, 2025
@ktaragorn
Copy link
Contributor Author

Oh thank you so much! Good to see the feature land!

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.

2 participants