ske5074
(SeanK)
September 4, 2022, 9:34pm
1
1. Output of caddy version
:
2.5.2
2. How I run Caddy:
caddy start
a. System environment:
5.15.63-0-lts #1-Alpine SMP Mon, 29 Aug 2022 07:17:28 +0000 x86_64 Linux
b. Command:
caddy start
c. Service/unit/compose file:
NA
d. My complete Caddy config:
wp.home.arpa {
encode gzip
reverse_proxy localhost:8080
file_server
@disallowed {
path /xmlrpc.php
path *.sql
#path /wp-content/uploads/*.php
}
rewrite @disallowed '/index.php'
reverse_proxy /xr/* 127.0.0.1:3000
}
xr.home.arpa {
@blocked not remote_ip 10.0.0.1/24
respond @blocked "<h1>Access Denied</h1>" 403
reverse_proxy 127.0.0.1:3000
}
3. The problem I’m having:
While xr.home.arpa works brilliantly, wp.home.arpa/xr/ fails, showing:
Cannot GET /mc/
4. Error messages and/or full log output:
No errors, just does not work.
5. What I already tried:
I tried using handle, handle_path, route, had to learn about without not working… I can easily do this in traefik (which is crazy since I moved to caddy to to traefik breaking from being so complex)
6. Links to relevant resources:
1. Caddy version (caddy version):
v2.4.3
2. How I run Caddy:
Systemd
a. System environment:
Ubuntu 18.04
b. Command:
/usr/local/bin/caddy run --environ --config /data/conf/caddy/Caddyfile
c. Service/unit/compose file:
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
Type=notify
User=root
Group=root
ExecStart=/usr/local/bin/caddy run --environ --config /data/conf/caddy/Caddyfile
E…
opened 10:50PM - 16 Aug 20 UTC
closed 11:02PM - 16 Aug 20 UTC
question
I have two sites:
- exampledomain.com
- datadomain.com
**exampledomain.… com** run caddy v2 has such config exampledomain.com/data point to datadomain.com.
**datadomain.com** also run caddy v2 with file_server config. There are also some folders called dataFolder_A, dataFolder_B, etc.
When click into datadomain.com and select dataFolder_A. You will enter datadomain.com/dataFolder_A to access some files on it.
However, I would like to use `exampledomain.com/data`, `exampledomain.com/data/dataFolder_A`, `exampledomain.com/data/dataFolder_B` to access `datadomain.com`, `datadomain.com/dataFolder_A`, `datadomain.com/dataFolder_B`, etc.
with config
```
exampledomain.com{
handle_path /data {
reverse_proxy datadomain.com
}
}
```
or
```
exampledomain.com/data {
uri strip_prefix /data
reverse_proxy datadomain.com
}
```
I can only access the exampledomain.com/data to the root path for datadomain.com. When entering exampledomain.com/data/dataFolder_A. It failed and turn back to exampledomain.com/dataFolder_A instead of exampledomain.com/data/dataFolder_A.
I've tried all these thress solutions for it: None of them works.
- https://github.com/caddyserver/caddy/issues/2813
- https://github.com/caddyserver/caddy/issues/3266
- https://github.com/caddyserver/caddy/pull/3281
See this article, which explains:
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…
1 Like
ske5074
(SeanK)
September 5, 2022, 12:01am
3
Thank you for the article. It certainly explains the issue. It looks like subdomains are the way to go, as the advanced option looks much more difficult. Thank you @francislavoie !
1 Like
system
(system)
Closed
October 4, 2022, 9:34pm
4
This topic was automatically closed after 30 days. New replies are no longer allowed.