Reverse proxy refuses to work

1. Caddy version (caddy version):

Latest: v2.3.0

2. How I run Caddy:

I want to reverse proxy my local webapps to make them accessible over the internet. I have a domain (whitelabs.xyz) over at namecheap which is DNS’d correctly. I only need to redirect demands from /[appname] to specific ports.

a. System environment:

Latest update of windows server 2019

b. Command:

caddy start

with my caddyfile in the same folder

c. Service/unit/compose file:

N/A

d. My complete Caddyfile or JSON config:

whitelabs.xyz 

reverse_proxy /sonarr 127.0.0.1:8989

I’ve also toyed around with having multiple redirects, using only http, nothing works.

3. The problem I’m having:

When I start caddy, no error messages are given


But when I try to connect to my website using the subfolder, I just get a blank page. My app is running because if I connect using my local network ip, I can see it. The problem comes from the redirect.

4. Error messages and/or full log output:

Nothing else is outputted from the console.

5. What I already tried:

I’ve tried to change base URL from my apps, rebooting my router (ports 80 and 443 are open, of course), having only one redirect in case I was fucking up the syntax, literally copy-pasting the instructions from jellyfin’s caddy setup page, nothing has produced results.
I once got it to work with sonarr and radarr using the exact same syntax, but then I added jellyfin and radarr and sonarr stopped working, even after I removed the jellyfin line and reloaded my config.

It has also worked when not using a subfolder (no matcher in the reverse_proxy string), and when using the reverse-proxy command, but then my entire domain redirects to one app, which is exactly what I want to use caddy for so…

6. Links to relevant resources:

Jellyfin caddy page:
https://jellyfin.org/docs/general/networking/caddy.html

Just FYI, you’re proxying only requests with exactly the path /sonarr – you probably want to proxy more than that, yes? Read about path matching here: Request matchers (Caddyfile) — Caddy Documentation

You probably want /sonarr*

Yes, good point, but I did try that before, I just removed the /* while testing and forgot to add it.

Current setup:

Bringing up whitelabs.xyz/sonarr gives me a blank page, no reaction whatsoever for the caddy window.
Bringing up localhost:8989 from the machine or 192.168.0.15:8989 from somewhere else on my local network does work, so the issue isn’t from sonarr.

That’s because you configured to proxy /sonarr/*, not /sonarr* – so if you don’t have the trailing slash, Caddy won’t proxy it.

Boy do I feel like a tool. Since local browser autocorrects /sonarr to /sonarr/, I didn’t put 2 and 2 together.
Thank you for your help.

Jellyfin should probably ammend their thing too, because it won’t work if the user doesn’t type the /, which I assume most wouldn’t.

1 Like

I recommend using a subdomain rather than a subpath when proxying services like this. e.g. sonarr.whitelabs.xyz