dnv
(Jago)
February 1, 2021, 8:11pm
1
1. Caddy version (caddy version
):
2.3.0
2. How I run Caddy:
docker-compose up -d
d. My complete Caddyfile or JSON config:
jump.systems.dance {
redir / /guacamole 308
reverse_proxy http://192.168.1.60:8081 {
flush_interval -1
}
}
3. The problem I’m having:
I want to redirect every single request to towards the /guacamole subdirectory on the server, while hiding it in the address bar.
5. What I already tried:
Tried “/*” instead of just “/”, also tried /guacamole both with the trailing slash and without
6. Links to relevant resources:
Found in Reverse Proxy Guacamole - #4 by francislavoie that this is how you are supposed to do this, but the redirect isn’t working for me.
dnv
(Jago)
February 1, 2021, 8:23pm
2
Also tried this version similar to the one found in the link provided in the OP:
jump.systems.dance {
@wrongPath {
not path /guacamole/*
}
redir @wrongPath /guacamole/
reverse_proxy http://192.168.1.60:8081 {
flush_interval -1
}
}
Redirect not happening. And:
jump.systems.dance {
redir / https://jump.systems.dance/guacamole 301
reverse_proxy http://192.168.1.60:8081 {
flush_interval -1
}
}
Doesn’t work either.
You’d want a rewrite then, not a redirect. A redirect is telling the browser to make a new request at a URL, by responding with the Location
header in the response.
You probably want this:
jump.systems.dance {
rewrite * /guacamole{path}
reverse_proxy http://192.168.1.60:8081 {
flush_interval -1
}
}
But be aware that you may run into issues if guacamole is not aware of this:
Have you ever tried to reverse proxy an app into its own little subfolder of your domain name?
Makes things neat, doesn’t it? Using example.com/foo/ for one app, example.com/bar/ for another. If you’re coming here from one of the selfhosted communities, you might be thinking along the lines of example.com/sonarr/, example.com/radarr/ etc.
Chances are, you’ve tried some configuration along these lines:
example.com {
redir /sonarr /sonarr/
handle_path /sonarr/* {
reverse_proxy localhost…
dnv
(Jago)
February 1, 2021, 10:14pm
4
Wait a moment. Trying out your configuration I’ve discovered a wholly unexpected fail from the undersigned. My docker-compose was pointing to the wrong Caddyfile so the changes I was trying out weren’t actually live in my containers. The redir works now.
okay then. But know that redir
will not let you achieve what you wrote here:
The redir
directive will not hide it from the address bar, because redir
literally tells the browser “hey, change the address bar to this!”
The “hiding” is done by doing rewrites, internally at the server.
dnv
(Jago)
February 1, 2021, 10:35pm
6
Yeah, the redir works now but I guess you are right regarding the rewrite and address bar.
system
(system)
Closed
March 3, 2021, 8:12pm
7
This topic was automatically closed after 30 days. New replies are no longer allowed.