Is it possible to run a reverse proxy only on a specific service or port?
https://lemmy.world/post/20431227
=> More informations about this toot | More toots from FarraigePlaisteach@lemmy.world
I just don’t put the ports on the proxy config.
=> More informations about this toot | More toots from femtech@midwest.social
So those ports that I don’t put in the config remain publicly accessible? That would be perfect.
=> More informations about this toot | More toots from FarraigePlaisteach@lemmy.world
The ports you don’t put in are not publicly routed.
I use NPM and only have 3 services routed outside my network.
=> More informations about this toot | More toots from femtech@midwest.social
First of all, doesn’t Navidrome have authentication? So, I don’t see why exposing it to the public is a problem.
Second, some reverse proxies support basic auth. This way, you can have authentication at the proxy level and is useful of the service does not support it. Here as an example snippet for Caddy:
basic_auth {
# Username "Bob", password "hiccup"
Bob $2a$14$Zkx19XLiW6VYouLHR5NmfOFU0z2GTNmpkT/5qqR7hx4IjWJPDhjvG
}
reverse_proxy myservice:8000
}
You’ll have to look up the docs for other reverse proxies.
=> More informations about this toot | More toots from foster@lemmy.fosterhangdaan.com
Thanks. You’re right shout Navidrome supporting authentication. I’m using HTTP instead of HTTPS, though. I was advised to use a reverse proxy to avoid potential legal issues.
=> More informations about this toot | More toots from FarraigePlaisteach@lemmy.world
How will a reverse proxy help?
Things that a reverse proxy is often used for:
Do any of these match what you’re trying to accomplish? What do you hope to gain by adding a reverse proxy (or maybe some other software better suited to your need)?
=> More informations about this toot | More toots from maxwellfire@lemmy.world
Thank you for the very informative reply.
The HTTP and Gemini services are for vintage clients, but I would like the reverse proxy to keep my media collection private (and maybe SSH and SMB too). So I’m serving to modern clients in the case of reverse proxy. I was told that port forwarding is no longer considered secure enough and that if my media gets publicly exposed I could be liable for damages to license holders.
=> More informations about this toot | More toots from FarraigePlaisteach@lemmy.world
Reverse proxies don’t keep anything private. That’s not what they are for. And if you do use them, you still have to do port forwarding (assuming the proxy is behind your router).
For most home hosting, a reverse proxy doesn’t offer any security improvement over just port forwarding directly to the server, assuming the server provides the access controls you want.
If you’re looking to access your services securely, then what you want is a VPN (for vpns, you also often have to port forward). Now, there’s a problem because companies have completely corrupted the normal meaning of a VPN with things like nordvpn that are actually more like proxies and less like VPNs. A self hosted VPN will allow you to connect to your hone network and all the services on it without having to expose those services to the internet.
In a way, VPNs often function in practice like reverse proxies. They both control traffic from the outside before it gets to things inside. But deeper than this they are quite different. A reverse proxy controls access to particular services. Usually http based and pretty much always TCP/IP or UDP/IP based. A VPN controls access to a network (hence the name virtual private network). When setup, it shows up on your clients like any other Ethernet cable or WiFi network you would plug in. You can then access other computers that are on the VPN, or given access to to the VPN though the VPN server.
The VPN softwares usually recommended for this kind of setup are wireguard/openvpn or tailscale/zerotier. The first two are more traditional VPN servers, while the second two are more distributed/“serverless” VPN tools.
=> More informations about this toot | More toots from maxwellfire@lemmy.world
That is such a clear explanation and makes a lot of sense, thank you again.
Since the services I’m interested in serving are authenticated then it sounds like HTTPS is what I need (which is what originally made the most sense to me). That’s a relief. I just need to figure out how to have separate HTTP and HTTPS services hosted from the one ARM service.
=> More informations about this toot | More toots from FarraigePlaisteach@lemmy.world
You have two options for setting up https certificates and then some more options for enabling it on the server:
1: you can generate a self signed certificate. This will make an angry scary warning in all browsers and may prevent chrome from connecting at all (I can’t remember the status of this). Its security is totally fine if you are the one using the service since you can verify the key is correct
2: you can get a certificate to a domain that you own and then point it at the server. The best way to do this is probably through letsencrypt. This requires owning a domain, but those are like $12 a year, and highly recommended for any services exposed to the world. (You can continue to use a dynamic DNS setup, but you need one that supports custom domains)
Now that you have a certificate you need to know,
Does the service your hosting support https directly. If it does, then you install the certificates in it and call it a day. If it doesn’t, then this is where a reverse proxy is helpful. You can then setup the reverse proxy to use the certificate with https and then it will connect to the server over http. This is called SSL termination.
There’s also the question of certificate renewal if you choose the letsencrypt option. Letsencrypt requires port 80 to do a certificate renewal. If you have a service already running on port 80 (on the router’s external side), then you will have a conflict. This is the second case where a reverse proxy is helpful. It can allow two services (letsencrypt certificates renewal and your other service) to run on the same external port. If you don’t need port 80, then you don’t need it.
So to summarize:
IF service doesn’t support SSL/https OR (want a letsencrypt certificate AND already using port 80)
Then use a reverse proxy
ELSE:
You don’t need one, but can still use one.
=> More informations about this toot | More toots from maxwellfire@lemmy.world
Thank you again for the response. The summary is very helpful too.
It looks like I don’t need the reverse proxy, since the sensitive services* support authentication and HTTPS.
I would need the lighttpd service to be available over unsecured HTTP too, but if that’s not possible I could always use a different subdomain.
=> More informations about this toot | More toots from FarraigePlaisteach@lemmy.world
A typical use case is to forward a single port to the proxy, then set the proxy to map different subdomains to different machines/ports on your internal network. Anything not explicitly mapped by the reverse proxy isn’t visible externally.
=> More informations about this toot | More toots from AbouBenAdhem@lemmy.world
That’s the standard behavior. Read the documentation for whatever reverse proxy you want to use.
=> More informations about this toot | More toots from catloaf@lemm.ee
The standard is that everything gets captured by the proxy? I want to leave the HTTP and Gemini servers public. I also want those and SMB to remain accessible on the LAN.
=> More informations about this toot | More toots from FarraigePlaisteach@lemmy.world
No, the standard is that it routes only what you configure.
=> More informations about this toot | More toots from catloaf@lemm.ee
Wonderful. Thank you!
=> More informations about this toot | More toots from FarraigePlaisteach@lemmy.world
For what it’s worth, though, you can proxy other services, like Gemini or gopher, through the same proxy for simplicity’s sake.
=> More informations about this toot | More toots from K3can@lemmy.radio
I’m afraid that when I install a reverse proxy, it’ll take my other stuff online and causes me various headaches that I’m not really in the headspace for at the moment.
If you don’t configure your other services in the reverse proxy then you have nothing to worry about. I don’t know of any proxy that auto discovers services and routes to them by default. (Traefik does something like this with Docker services, but they need Docker labels and to be on the same Docker network as Traefik, and you’re the one configuring both of those things.)
Are you running this on your local network? If so, then unless you forward a port to your server on the port your reverse proxy is serving from, it’ll only be accessible from the local network. This means you can either keep it that way (and VPN in to access it) or test it by connecting directly to your server on that port and confirm that it’s working as expected before forwarding the port.
=> More informations about this toot | More toots from hedgehog@ttrpg.network
Thank you so much. That clears up all my doubts. I’m running an ARM server ok the lan with port forwarding for HTTP (80) Gemini (1965) and SMB (not forwarded).
=> More informations about this toot | More toots from FarraigePlaisteach@lemmy.world
I made a typo in my original question: I was afraid of taking the services offline, not online.
Gotcha, that makes more sense.
If you try to run the reverse proxy on the same server and port that an existing service is using (e.g., port 80), then you’ll run into issues. You could also run into conflicts with the ports the services themselves use. Likewise if you use the same outbound port from your router. But IME those issues will mostly stop the new services from starting - you’d have to stop the services or restart your machine for the new service to have a chance to grab the ports while they were unused. Otherwise I can’t think of any issues.
=> More informations about this toot | More toots from hedgehog@ttrpg.network
That’s reassuring. Thanks, I was struggling with the concept and where to start but I should be fine now since I’m handy enough with a terminal.
=> More informations about this toot | More toots from FarraigePlaisteach@lemmy.world
My method:
VPS with reverse proxy to my public facing services. This holds SSL certs, and communicates with home network through WireGuard link configured on my router.
Local computer with reverse proxy for all services. This also has SSL certs, and handles the same services as the VPS, so I can have local/LAN speeds. Additionally, it serves as a reverse proxy for all my private services, such as my router/switches/access point config pages, Jellyfin, etc.
No complaints, it mostly just works. I also have my router override DNS entries for my FQDN to resolve locally, so I use the same URL for accessing public services on my LAN.
=> More informations about this toot | More toots from qjkxbmwvz@startrek.website
Thanks! Is the point of reverse-proxying your public-facing services to make them private?
=> More informations about this toot | More toots from FarraigePlaisteach@lemmy.world
It’s mostly so that I can have SSL handled by nginx (and not per-service), and also for ease of hosting multiple services accessible via subdomains. So every service is its own subdomain.
Additionally, my internal network (as in, my physical LAN) does not have any port forwarding enabled — everything is over WireGuard to my VPS.
=> More informations about this toot | More toots from qjkxbmwvz@startrek.website
How are you currently serving publicly?
=> More informations about this toot | More toots from mvirts@lemmy.world
Linux running HTTP and Gemini servers. This is fine from home using port forwarding and afraid.org’s dynamic DNS.
=> More informations about this toot | More toots from FarraigePlaisteach@lemmy.world This content has been proxied by September (3851b).Proxy Information
text/gemini