pippo73
(Pippo73)
February 17, 2022, 4:53pm
1
1. Caddy version (caddy version
):
2.4.6
2. How I run Caddy:
Docker
a. System environment:
Raspberrypi 4 + Debian 64bit
3. The problem I’m having:
Actually I have the following configuration
Router - server - port 1
- port 2
- port 3
On every port I have different service running on my server.
I would like to know how it is possible to configure caddy in order to access the different services with a different subdirectory something like
http://myserver/subdir instead of http://myserver :theportoftheservice
myserver:443 {
root * /var/www/html/
file_server
reverse_proxy /subdir/* 192.168.1.10:theportoftheservice
tls /etc/caddy/SSL/cert1.pem /etc/caddy/SSL/privkey1.pem
}
it seems it is not working
4. Error messages and/or full log output:
If I try to connect to https://myserver/subdir
I get the following page
This is not the page you are looking for
The file /zigbee/ couldn’t be found.
5. What I already tried:
See the Caddyfile part I’ve posted
6. Links to relevant resources:
What you’re asking about is not redirects, but proxying. Very different concepts.
A redirect in the context of web/HTTP is a specific kind of HTTP response which contains a Location
header which tells the client to try again but at a different URL.
That said, there’s often issues with proxying to upstream services that aren’t designed to work under subpaths. It’s generally much easier to use subdomains for each service instead, like sub.example.com
instead of example.com/sub
.
See this article which explains in detail:
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…
system
(system)
Closed
March 19, 2022, 4:53pm
3
This topic was automatically closed after 30 days. New replies are no longer allowed.