Proxy URL not loading site?

Hi, total amateur here,

I’m just getting started with proxying…and can’t seem to get sonarr to load properly and I’m confused why, sabzbd loads fine.

the url just spits out Sonarr Ver.

proxy /sonarr { #

Hi @robertgranholm, welcome to the Caddy community. We all started somewhere!

In this case, you’ve run straight into one of the most prevalent obstacles people face when trying to reverse proxy apps - the “subfolder problem”. You’ll hit this regardless of what program you use as a reverse proxy, because it’s a logical problem, not a bug in the web server or the app itself.

Just about every app is written under the assumption that it is being served at the web root, i.e. - but in your case, it isn’t. You’re only serving it at

So when the app tries to serve you CSS and JS assets, which it needs to render the site, it tells your browser to grab /foo.css and /bar.js instead of /sonarr/foo.css and /sonarr/bar.js. Caddy doesn’t know it has to forward these on to Sonarr, so it throws back a 404, and your app doesn’t render properly.

Sonarr actually has a setting you can use to configure the subfolder - like most apps that are configurable in this way, the setting is referred to as a “URL base”. You can find it at - in your case, set it to /sonarr and then go to System and restart the app.

For apps that don’t have a URL base option, your only (edit: straightforward, at least, other methods are possible but difficult and complicated) workaround is to serve them on a subdomain instead of a subfolder and let them have their assumed web root.

1 Like

Hrmm, okay, so learning curve here. I don’t have a problem persay with making the services subdomains…but the main url is already a subdomain…would I need to rework that alltogether?

Back to testing and documentation I guess

Thanks for the context, that helped!

You can make a subdomain of your subdomain, if you wanted! E.g.

Just make sure the DNS records are set and you’re, well, all set.

One trick I like to use, is for a given host (lets call it myhost), set a wildcard DNS record as a CNAME: * to

Then everything that’s a subdomian of points to myhost by default and I don’t need to add records every time I think about setting up a new service.

Woah, I think you just blew my mind with a subdomain of a subdomain. I’ve never set one of those up before. So this domain is on Google Domains, and since is going to a home server, it’s setup with Dynamic DNS through DNS O Matic.

However I don’t think that matters, if I setup * to go to …it’ll all hit my server, however how does caddy know what to do with it…will caddy pick up if the url matches a service it has defined and then route properly from there?

Hmm this doesn’t seem right…

You just put the URLs you want Caddy to handle in the Caddyfile!

Like: {
  proxy / service1
} {
  proxy / service2

If you want to catch all the stragglers for random sub-subdomains you aren’t expecting, you can do that:

* {

  # Maybe grab a wildcard cert so this just works for HTTPS regardless of the hostname?
  # tls {
  #   dns cloudflare
  # }

Looks good to me. The first column is actually *, the panel is just omitting the because that’s the Registered Domain, it’s implied.

Although, actually, it looks like it’s CNAME’d to instead of

Hmm cool, alright, that’s in place, now to play around and test it. Thanks

So when I do a look up, it’s returning the IP for the main domain, which is on Google Domains for whatever they put up for a website … not the subdomain which is my IP from my ISP routing to my home server.

Yeah the CNAME target definitely needs to be, not Double check the CNAME target in your DNS control panel.

1 Like

Got it figured, thanks x10! Onward to the testing fun…after work…tonight… : )

1 Like

So I understand how the wildcard works and the sub sub domain.

So, since the services can have their “roots” and I can access those via the subsubs…I just need to tell caddy about it…right?..something like this?

proxy {          #

I shouldn’t need to mess with the settings on the actual services right? Or should I go say, use HTTPS and give them the caddy enabled subsubdomain addresses?

That’s not it, tried this but that’s not working either… {
proxy / #

Should there be a space there that’s missing?

Have a read of the proxy docs. Your second try is the one that looks closest to what you should be using.

I tried that as well, got this error.

2019/04/04 08:05:26 Caddyfile:132 - Error during parsing: Unknown directive ‘

I’ll see if there’s mention of that error in the docs.

Hmm so I read through the proxy page but not much applied.

I think it’s in defining what to proxy, is caddy seeing as a different site maybe? so I need to define this outside the primary `

{ ` opener? … I’ll try that

No that didn’t work but I think it has something to do with the domains being different…the new subdomains, do I need to define them separately from the first I was using…with separate root paths?

Figured out my brackets which I think were causing the issue but now my domain lookups aren’t working when they were yesterday! Hmmpph!

mediacenterserver:caddy mediacenter$ sudo caddy

Activating privacy features... 2019/04/04 09:20:14 [INFO] [] acme: Obtaining bundled SAN certificate

2019/04/04 09:20:16 [INFO] [] AuthURL:

2019/04/04 09:20:16 [INFO] [] acme: use tls-alpn-01 solver

2019/04/04 09:20:16 [INFO] [] acme: Trying to solve TLS-ALPN-01

2019/04/04 09:20:22 [] failed to obtain certificate: acme: Error -> One or more domains had a problem:

[] acme: error: 400 :: urn:ietf:params:acme:error:dns :: DNS problem: NXDOMAIN looking up A for, url:

and I have this for my DNS settings still…

Got it! Google actually wanted *.mainframe and routing it to odd, but got it working…onward!