mirror of
https://github.com/pikvm/pikvm.git
synced 2026-03-02 18:16:56 -05:00
BaseURL configuration for Reverse Proxy with NGINX or others #994
Labels
No labels
component:documentation
help wanted
resolution:delayed
resolution:duplicate
resolution:fixed
resolution:invalid
resolution:rejected
resolution:wontfix
success story
type:bug
type:bug
type:feature
type:question
type:question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/pikvm-pikvm#994
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MichaelWoodc on GitHub (Jan 22, 2025).
When I setup my network, I would like to have my pikvm accessible with a different base url or path so that I can have only one or two ports open to the outside world. (I've been fending off cyber threats). So, I need my pikvm accessible at myurl.com/pi_kvm through my reverse proxy. This will allow me to sunset RDP for remote management, where I've been peppered with thousands of failed login attempts lately.
In other services like Navidrome I can easily set up a base path, like this:
Describe the solution you'd like
I'd like to have a super easy place to setup a path for a reverse proxy like this
Describe alternatives you've considered
I've tried complicated reverse proxy setup, like this, but it didn't work. I got so close, but the post address for the login was incorrect and a few other things:
Additional context
The only thing I've been able to do is do a subdomain. This works great. I'd prefer to be able to implement it this other way, however.
@MichaelWoodc commented on GitHub (Jan 23, 2025):
I did some exploring today, it seems there might be an easy way. I went to the web terminal and did:
find/ -name "nginx" 2>/dev/nullThat returns everything having to do with nginx. I popped the most likely file into the editor
I'm not entirely faililiar with nginx yet, but it seems this might be a place to edit the base URL. Some experimenting is necessary.
nginx.conf.txt
@MichaelWoodc commented on GitHub (Jan 23, 2025):
A little more digging and I have found a lot of files in: /etc/kvmd/nginx
that seem to have everything to do with it.
It looks like I could just add /pi_kvm everywhere there. Is that correct?
@mdevaev commented on GitHub (Jan 27, 2025):
Don't do this, you can misconfigure something and pikvm will break. We will make specific fix for this problem.
@MichaelWoodc commented on GitHub (Jan 31, 2025):
Please let me know if and how I can help out on this one! And thanks guys!
@mdevaev commented on GitHub (Feb 1, 2025):
I'm working on it now.
@mdevaev commented on GitHub (Feb 2, 2025):
Okay, it's done. Please update OS. No additional settings are required for base url.
I also wrote a small guide for reverse proxying with two tested example configs: https://docs.pikvm.org/reverse_proxy/
@MichaelWoodc commented on GitHub (Feb 3, 2025):
Thanks! I hit that button on the main page, hopefully it's enough to get a coffee where you're at. Saved me a lot of work!
@mdevaev commented on GitHub (Feb 4, 2025):
Merci👌
@fallenleavesgocrunch commented on GitHub (Feb 9, 2025):
This hasn't worked for me. When I go to /pikvm/ it redirects back to /login with the handle_path directive in caddy. I know this was closed only last week so I hope it's still fresh off the rack and there's something I can do to debug what's going wrong....
I have cache disabled and preserve logs enabled in Chrome and I get the following actions:
caddy:
pikvm:
kvmd 4.52-1
kvmd-fan 0.32-1
kvmd-platform-v4mini-hdmi-rpi4 4.52-1
kvmd-webterm 0.50-1
@mdevaev commented on GitHub (Feb 10, 2025):
Yes, it seems I missed it with Caddy. PiKVM has a login redirect location in the internal nginx:
To handle it in the proxy Nginx I used this:
We need something similar on Caddy. Do you know about it? I don't have much Caddy experience.
In the meantime, I will try to find a way to change this redirect by making it relative on the PiKVM side.
@mdevaev commented on GitHub (Feb 10, 2025):
@fallenleavesgocrunch I found a solution. You need to add
header_downinstruction:I've tested it and updated documentation.
@fallenleavesgocrunch commented on GitHub (Feb 10, 2025):
Wow that was fast! Thank you :)
@mdevaev commented on GitHub (Feb 10, 2025):
Ur welcome 👌