Caddy with Xteve - won't forward to the login page

1. Caddy version (caddy version):

v2.4.6

2. How I run Caddy:

as a service

a. System environment:

ubuntu 20

d. My complete Caddyfile or JSON config:

https://www.dumbdomain.com {
reverse_proxy 127.0.0.1:8096
}

xteve.dumbdomain.com {
reverse_proxy 127.0.0.1:17122/web
}

3. The problem I’m having:

I have caddy setup to redirect main URL requests to a Jellyfin server and some subdomain requests to apps like sonarr, etc. It all works perfectly. Except I cannot get it to redirect XTEVE. the page redirects and hangs, never loads.

4. Error messages and/or full log output:

page hangs blank and never loads

5. What I already tried:

changing the syntax of the caddyfile
researching potential reasons

6. Links to relevant resources:

this is almost certainly an xteve problem not a caddy problem (http->https issues, I don’t know) but I thought perhaps someone here knew a work around.

Caddy’s reverse_proxy does not support paths in the upstream address. Remove the /web from here.

Are you trying to add a path prefix to all requests before proxying? If so, use the rewrite directive. Something like rewrite * /web{uri}

But what are in your logs though? You can find the command to see your logs here:

I’ll check the log, I didn’t know I couldn’t specify a path. Xteve runs on whatever port you tell it (in my case 17122) but if you go to 17122, you get the tuner, not the web admin interface. You have to go to the path to get the interface.

Is there any workaround for this within Xteve?

I don’t understand the question. Please be more specific, what behaviour do you need to happen?

Sorry my post was really unclear.

I have a service/app running on port 17122. However, to access the service UI, you have to go to www.myapp.com:17122/web you cannot access it at www.myapp.com:17122. From what I understand from your previous post, caddy cannot forward to a specific path? Is there any workaround for this? I would like

subdomain.myapp.com to be redirected by caddy to the admin login / UI. But that web page requires the path /web

Yes it can, like I said, you need to use a rewrite to change the path before proxying. The reverse_proxy module no longer does rewrites itself (in v1 it did, but it no longer does, separation of concerns, less code overall).

I read the documentation on it and I guess I understand it but I don’t see any examples of syntax specific to reverse proxy. Is there any further information about the rewrite command I could look at?

It’s nothing specific to reverse_proxy, I already gave you the line to use:

Thank you. I’m very new to this and don’t understand where in my Caddyfile this would go. I’m also not sure where in that command I would put my specific information. What is web{uri} ? Do I put my url+port number where the * is ? Do I still need a reverse_proxy line in my Caddyfile or does rewrite replace it entirely?

Please read this page in the docs to understand how a Caddyfile is structured:

/web is the prefix you want to add to the URL, and {uri} is a placeholder for “the current URI of the request” (i.e. the path + query).

No, * is a request matcher:

It’s necessary to explicitly use * here because /web{uri} starts with a / which would make the request matcher parsing assume that /web{uri} is your matcher, but that’s not the case, that’s the rewrite target. So you need to put * to make sure that * is used as the matcher (which means “match all requests”).

Yes, because that’s what actually proxies the request. The rewrite directive just modifies the current request being handled, to change the URI (request path and query).

Is there an example of this kind of Caddyfile in use? I don’t really understand some of what you’re saying.

I want

subdomain.dumbdomain.com to reverse_proxy to 127.0.0.1:17122/web

This is the ONLY subdomain that needs a path, everything else in my Caddyfile is working. Is there a sample Caddyfile I could look at to understand it better. I know you’ve linked me to the documentation but they are a little advanced for me.

xteve.dumbdomain.com {
	rewrite * /web{uri}
	reverse_proxy 127.0.0.1:17122
}

Thank you for the response. When I put this in, I get the following in my browser: (notice the URL /web/web/web/web)

this is my entry in my caddyfile:

xteve.dumbdomain.com {
rewrite * /web{uri}
reverse_proxy 127.0.0.1:17122
}

Then there’s not much you can do in Caddy. Your upstream app is triggering the redirects. You’ll probably have to use /web in the URL in the browser.

This topic was automatically closed after 30 days. New replies are no longer allowed.