this post was submitted on 13 Nov 2023
2 points (100.0% liked)

Self-Hosted Main

515 readers
1 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

For Example

We welcome posts that include suggestions for good self-hosted alternatives to popular online services, how they are better, or how they give back control of your data. Also include hints and tips for less technical readers.

Useful Lists

founded 1 year ago
MODERATORS
 

This seems too straightforward, what's the catch?

Like how secure is it? Should I be turning it off (and disabling the port forwarding) when not using it?

Do I need any additional security? Mainly just want to use it for Jellyfin

Thanks

top 50 comments
sorted by: hot top controversial new old
[–] dinosaurdynasty@alien.top 2 points 1 year ago

I would not directly expose Jellyfin to the Internet (including reverse proxy) because of security issues they've had. And no, a reverse proxy (like Caddy) doesn't usually add much insecurity or security^.

The thing I currently do is use forward_auth w/ Authelia (from anywhere, you could also use basic_auth though the UX sucks) but bypass it for the app in private IP ranges (aka at home or in VPN):

jellyfin.example {
        @notapp {
                not {
                        header User-Agent *Jellyfin*
                        client_ip private_ranges
                }
        }

        forward_auth @notapp localhost:8080 {
                uri /api/verify?rd=https://authelia.example/
        }
        reverse_proxy 192.168.1.44:8080
}

Apps get to continue working, and I can access it from my phone without a VPN setup (because it's annoying and I only look at metadata on my phone anyway).

You can also do a simpler config (which I used to do) where you just give an HTTP Unauthorized for anything outside of private ranges (this lets you do the HTTP challenge for a certificate while still not exposing Jellyfin to the general internet).

^You can configure more security by doing authentication in the reverse proxy so that anyone trying to attack services behind it must first authenticate with the reverse proxy, but this is not the default. Security-wise this ends up similar to forcing all access through a VPN first, if a little harder to setup.

[–] Hot_Nectarine_5816@alien.top 1 points 1 year ago

I started with caddy because it seemed to have the least complex config file even though the documentation lacks examples which I found really annoying when troubleshooting or trying any less basic stuff. I also found certificate related issues really hard to fix.

Now I run nignx-proxymanager as a docker-container which unifies nearly all services into portainer for updating therefore making it easier to keep my stuff up to date. nginx-proxymanager is also much easier imo on the certificate side of things. I create wildcard certificates for a few domains and select the right one depending on the proxy I add. I also use forwards for a few of my shelly-devices which don't seem to work with proxies and make it easier for me to access them via a domain instead of memorizing a growing number of IPs.

[–] jax7778@alien.top 1 points 1 year ago

Caddy is a great, easy web server. It honestly has some pretty good performance too. If you want to see some good tests against nginx, take a look at this:

https://blog.tjll.net/reverse-proxy-hot-dog-eating-contest-caddy-vs-nginx/

tldr: Optimized nginx does outperform caddy in some areas in under heavy load, and they have a completely different strategies to handle failure. Under very heavy load Nginx just starts dropping and refusing connections to keep itself fast, while caddy will dramatically slow down response times in order to keep failures from happening.

[–] adamshand@alien.top 1 points 1 year ago (9 children)

I switched from Traefik to Caddy a few years ago and have no ragrets. The only complaints I have about Caddy:

  • It doesn't support configuring virtual hosts automatically via docker labelsl (like Traefik).
  • Many features (like DNS auth for certs) require compiling Caddy. Which is easy but annoying.
[–] ghoarder@alien.top 1 points 1 year ago

I wrote something that can setup caddy automatically from docker labels.

It's not well documented as I mostly wrote it for myself. https://hub.docker.com/r/mheys1/docker-dynamic-caddy https://github.com/mattheys/ddc

It basically acts like a DNS server serving up SRV records that caddy can use for dynamic configuration, I added in an on_demand_tls endpoint as well so that you don't get spammed for non existent TLS records.

[–] madrascafe@alien.top 1 points 1 year ago

You mean using dns providers like cloud flare?

It’s very easy just don’t this

caddy add-package github.com/caddy-dns/cloudflare

[–] _unbanned_datum@alien.top 1 points 1 year ago (1 children)

Anyone know if Caddy would be a good pick for a reverse proxy on a public subnet to distribute traffic to a bunch of subdomains in low traffic settings? I figure it could be a single source for all HTTPS stuff in my stack.

Or is it really just for like single applications running through Docker? Sorry, I haven’t played with it too much.

[–] MaxGhost@alien.top 1 points 1 year ago

Yes, it excels at that usecase. Caddy will automatically set up and manage certificates for each subdomain.

[–] Exist4@alien.top 1 points 1 year ago (1 children)

Random question from a noobie…. Why do you use something like Traefik versus something like Cloudflare Zero Access? (Again sorry if question is dumb). I’m just a new guy to this learning as I go and after getting up zero access with a $8 domain and now being able to securely access everything via subdomains it seems confusing why apps like Traefik are still so popular? I know I’m missing something there but hoping someone points it out.

[–] adamshand@alien.top 1 points 1 year ago

Because this is r/selfhosted. :-)

[–] rodude123@alien.top 1 points 1 year ago (1 children)

Don't hate me but I use Apache2, why would use caddy?

[–] adamshand@alien.top 1 points 1 year ago

I used Apache for many years. It’s great! But Caddy is simpler, easier and lighter weight.

[–] shahmeers@alien.top 1 points 1 year ago (1 children)

It doesn't support configuring virtual hosts automatically via docker labelsl (like Traefik).

Here you go: https://github.com/lucaslorentz/caddy-docker-proxy. No more extra Caddy configuration file.

[–] brando56894@alien.top 1 points 1 year ago

Whoa, just when I thought I had completed my setup haha

[–] Veloder@alien.top 1 points 1 year ago (1 children)

If you are using Docker, check out this repository for Caddy builds with different plugins https://github.com/serfriz/caddy-custom-builds

[–] adamshand@alien.top 1 points 1 year ago
[–] bbaulenas@alien.top 1 points 1 year ago

I have not tested it, but someone did auto discovery for caddy

https://github.com/lucaslorentz/caddy-docker-proxy

[–] sarkyscouser@alien.top 1 points 1 year ago

I use Caddy and agree with your last point in the context of Crowdsec

[–] 12_nick_12@alien.top 1 points 1 year ago

It's no different than NGiNX, put in your config and it just works.

[–] thekrautboy@alien.top 1 points 1 year ago (1 children)

Caddy is very basic, and thats why it works so easily. There is nothing wrong with it.

However it lacks some features that other reverse proxies offer. But if you dont need any of those, use Caddy.

Additional security? Not directly. But fail2ban and CrowdSec are easily set up too. And Caddy also combines very well with Authelia for authentication.

load more comments (1 replies)
[–] autogyrophilia@alien.top 1 points 1 year ago (3 children)

The documentation it's surprisingly bad at explaining common patterns of use.

It is also a bit thicker compared to nginx or HAproxy.

[–] EagerDevourer@alien.top 1 points 1 year ago (1 children)

Really? My experience was the opposite. I found everything I needed intheir docs rather quickly.

I guess it's true they don't have as many basic examples as nginx, but I'd take their lack of example over the mess an nginx config can become any day.

[–] brody5895@alien.top 2 points 1 year ago

Maybe just cause I'm still learning this stuff but I found the docs fairly challenging to comprehend too. Now that I get the basics though, it's pretty easy looking back

[–] xkcd__386@alien.top 1 points 1 year ago (1 children)

Totally agree.

The main problem is it's all written as a reference -- for people who already understand what/how, who need to just refresh their memory of the actual syntax.

There's very little explanatory stuff for people who need more than that. I had to read the same stuff multiple times, traversing many (or often, the same!) links, make notes, and then form a mental picture of what is going on.

[–] MaxGhost@alien.top 1 points 1 year ago (5 children)

Caddy maintainer here, if you could point to specific sections you find confusing, that would help. We rarely receive actionable feedback about the docs, so it's hard for us to make improvements.

[–] xkcd__386@alien.top 1 points 1 year ago (1 children)

at the moment my caddy setup is stable; I am recounting my experience from memory.

It may be useful to consider what I said in a broader perspective -- i.e., what you have is an excellent reference but it does not help discovery of task-oriented solutions.

Sorry I am unable to express the problem better than that. Will keep an eye out in future if I can get more concrete and open an issue or something.

[–] MaxGhost@alien.top 1 points 1 year ago (1 children)

😬 Well, that's not helpful. Without specific feedback, there's nothing we can do to improve the docs. It's exhausting to read vague complaints about the docs, because it's 90% of the feedback we get.

But yes, please do reach out (open a GitHub issue, comment on the forums etc) if you do notice something that doesn't meet your expectations in the docs.

[–] RandomName01@alien.top 1 points 1 year ago (4 children)

What I think they meant is more “how to achieve X or Y” focused documentation, rather than just explaining how features A or B work. The former approach explains what you should use and how to do it, the latter only documents what each variable does.

To use an analogy: I could probably build a bicycle from the individual parts based on a tutorial with that goal in mind, but not based on the individual technical descriptions of each part.

/u/xkcd__386 is that what you meant?

[–] xkcd__386@alien.top 1 points 1 year ago

Spot on.

Of course from their point of view that's "not helpful". Maybe I'll spend some time looking at it to come up with something, if I have time.

load more comments (3 replies)
[–] Do_TheEvolution@alien.top 1 points 1 year ago (1 children)

Something I encountered last week.

  • wanted to test running caddy without https and without being open to the world, to turn off automatic https.
  • Googled and came up with auto_https off documentation that I read.
  • It did not work, http still did not work
  • Googled more and landed on forum page that explained why auto_https is not working and that it needs explicitly stated http:\\ or port :80 in the address. Otherwise caddy will listen by default for only https.

It was no biggie, that forum post is literally the second google result for auto_https and does good job, but you asked and I have it fresh in memory...

[–] MaxGhost@alien.top 1 points 1 year ago

Thanks, that's helpful. Yeah the docs for auto_https should explain up-front that this only affects the feature called "Automatic HTTPS" and does not change the default port/procotol of Caddy, which is always HTTPS unless otherwise specified (i.e. by using http:// as a site address prefix, or :80 as a suffix).

load more comments (3 replies)
[–] MaxGhost@alien.top 1 points 1 year ago

Caddy maintainer here, which patterns are you confused about?

What do you mean by "thicker"? I don't think I agree but I'm not sure what you mean.

[–] macka654@alien.top 1 points 1 year ago (2 children)

What is it? Is it an alternative to unraid?

[–] mrcaptncrunch@alien.top 1 points 1 year ago

No, it’s a web server and reverse proxy.

It automatically adds HTTPS using let’s encrypt certificates.

[–] chaplin2@alien.top 1 points 1 year ago (2 children)

How do you compare Caddy with nginx proxy manager?

[–] eagle101@alien.top 1 points 1 year ago

Id say npm is 10x better than caddy

[–] Do_TheEvolution@alien.top 1 points 1 year ago

npm is nice for people who want easy web gui to configure stuff

caddy makes me feel more in control, its easier to backup too, since its all in one easy and readable config, and probably has more features as you go with your needs

There is also not that layer of which developer fucked up that you get when projects are projects of projects...

[–] ribbit43@alien.top 1 points 1 year ago

there are some trade offs, mostly performance

[–] scmmishra@alien.top 1 points 1 year ago (1 children)

Lack of docker labels is a downer, but it’s the best reverse proxy I have used. Recently started a project to run containers with caddy

https://github.com/scmmishra/slick-deploy

load more comments (1 replies)
[–] CWagner@alien.top 1 points 1 year ago

Caddy is great, been using it for a long time and made the switch from v1 to v2. The biggest negative, IMO, is that examples are usually for NGINX. This is fine if all you have to do is to translate the nginx 5-liner into a Caddy 1-liner, but for nextcloud, the code was a bit more complicated and required some googling (as people had that issue before and their forums are helpful).

LLMs can also be useful for translating nginx directives to caddy.

[–] -eschguy-@alien.top 1 points 1 year ago

Been using it for a few years now, and yeah, it's just that simple.

I have 443 open and pointing at my Caddy instance, it handles everything else.

[–] sixstringnerd@alien.top 1 points 1 year ago (3 children)

Can somebody explain in plain English what it is used for?

[–] bemasher@alien.top 1 points 1 year ago

Caddy is an http server, often used as a reverse proxy. It’s particularly useful for TLS termination and automatic TLS certificate management.

load more comments (2 replies)
[–] sevlonbhoi1@alien.top 1 points 1 year ago

been running my reverse proxy on caddy from last 4-5 years. No issues at all. No maintenance needed. Setup and forget. Just needs a simple config file. Auto certificate generation.

[–] brando56894@alien.top 1 points 1 year ago

After using Nginx for almost a decade, Caddy is pretty damn awesome regarding how simple it is. I don't need 8-10 lines of code to setup an SSL secured reverse proxy, I need three.

[–] ithilelda@alien.top 1 points 1 year ago

It is a simple layer 7 proxy and nothing more. It is the simplest so it works. As a comparison, almost all other reverse proxies can handle layer 4 traffic.

and I don't miss the label feature of traefik at all. centralized config for an entrance gateway is so much easier to maintain and find security flaws. I think labeling would be useful only in production clusters with thousands of microservices that you absolutely need the reverse of control to get away from dependency hell. Otherwise, I advice against using such feature, not even with a caddy plugin. (I mean if you really need it, why not just use traefik...)

load more comments
view more: next ›