I’m new to Caddy, but so far it works quite well. I migrated from NPM.
I’m trying to use an search application for Jellyfin called Jellysearch. There’s a hint how to reverse proxy via Traefik and NPM, but I can’t figure out how to use this in Caddy.
In NPM there would be an additional rule:
if ($arg_searchTerm) {
proxy_pass http://jellysearch:5000;
break;
}
the relevant part from the Caddyfile (reverse proxy/Authelia is working on jellyfin)
streaming.domain.com {
forward_auth ip:9091 {
uri /api/authz/forward-auth
## The following commented line is for configuring the Authelia URL in the proxy. We strongly suggest
## this is configured in the Session Cookies section of the Authelia configuration.
# uri /api/authz/forward-auth?authelia_url=https://auth.example.com/
copy_headers Remote-User Remote-Groups Remote-Email Remote-Name
## This import needs to be included if you're relying on a trusted proxies configuration.
import trusted_proxy_list
}
reverse_proxy ip:8096 {
## This import needs to be included if you're relying on a trusted proxies configuration.
import trusted_proxy_list
}
Thank you so much for your response and help. I’m feeling like a real noob here, because I can’t get the query to work. Could you please hint me where to put it in my config snippet?
Update:
I did manage to insert the query matcher and start caddy without error, but the redirect won’t work. I stuck at the streaming.domain.com site
This is my Caddyfile snippet:
streaming.domain.com {
forward_auth ip:9091 {
uri /api/authz/forward-auth
## The following commented line is for configuring the Authelia URL in the proxy. We strongly suggest
## this is configured in the Session Cookies section of the Authelia configuration.
# uri /api/authz/forward-auth?authelia_url=https://auth.example.com/
copy_headers Remote-User Remote-Groups Remote-Email Remote-Name
## This import needs to be included if you're relying on a trusted proxies configuration.
import trusted_proxy_list
}
reverse_proxy ip:8096 {
## This import needs to be included if you're relying on a trusted proxies configuration.
import trusted_proxy_list
}
@search {
query searchTerm=*
}
reverse_proxy @search ip:5000
log {
output file /data/log/jellyfin.access.log {
roll_size 10mb
roll_keep 10
roll_keep_for 36h
}
format json {
time_format iso8601
}
}
}
streaming.domain.com {
forward_auth ip/container:9091 {
uri /api/authz/forward-auth
## The following commented line is for configuring the Authelia URL in the proxy. We strongly suggest
## this is configured in the Session Cookies section of the Authelia configuration.
# uri /api/authz/forward-auth?authelia_url=https://auth.example.com/
copy_headers Remote-User Remote-Groups Remote-Email Remote-Name
## This import needs to be included if you're relying on a trusted proxies configuration.
import trusted_proxy_list
}
reverse_proxy ip/container:8096 {
## This import needs to be included if you're relying on a trusted proxies configuration.
import trusted_proxy_list
}
@search {
query searchTerm=*
}
reverse_proxy @search ip/container:5000
log {
output file /data/log/jellyfin.access.log {
roll_size 10mb
roll_keep 10
roll_keep_for 36h
}
format json {
time_format iso8601
}
}
}
It does work now. I don’t know if it was the command or clearing the cookies.
Thank you very much!
I also can’t get it to work. I am on an Unraid server with docker. I keep getting the error “connect: connection refused” so my guess is that there’s something wrong with the “trusted_proxies” directive but I don’t really know what I should put there.
Thanks in advance for the help!
So no problem with my Caddyfile then? Could it be that jellysearch is not correctly “linked” to caddy? The jellysearch docs say that you have to use port 5000 but I can’t see under “port mappings” in the “Docker” tab on UnRaid.
I hope I don’t bother you I’m a bit new to all this