1. The problem I’m having:
noob question, I’m trying to make foo.purplepuppy.com/example.jpg
be synonymous with bar.purplepuppy.com/file/foo/example.jpg
currently trying stuff like:
foo.purplepuppy.com {
@needsRewrite {
not path /file/foo/*
}
rewrite @needsRewrite /file/foo{uri}
reverse_proxy bar.purplepuppy.com
}
but still getting infinite redirects (see next section), any ideas how to fix?
I want the url bar to show foo.purplepuppy.com/example.jpg
without showing the bar.purplepuppy.com/file/foo/example.jpg
, but the page should display as though the user has gone to bar.purplepuppy.com/file/foo/example.jpg
.
Please note that I cannot change anything about bar.purplepuppy.com
because it is a CNAME for f001.backblazeb2.com.
2. Error messages and/or full log output:
The problem is that I’m getting infinite redirects of the form:
https://foo.purplepuppy.com/file/foo/file/foo/file/foo...
3. Caddy version:
v2.9.1 h1:OEYiZ7DbCzAWVb6TNEkjRcSCRGHVoZsJinoDR/n9oaY=
4. How I installed and ran Caddy:
173 sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
174 curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
175 curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
176 sudo apt update
177 sudo apt install caddy
a. System environment:
Ubuntu 22.04.4 LTS
b. Command:
sudo systemctl reload caddy
d. My complete Caddy config:
purplepuppy.com, www.purplepuppy.com {
root * /www/purplepuppy.com
file_server
}
foo.purplepuppy.com {
@needsRewrite {
not path /file/foo/*
}
rewrite @needsRewrite /file/foo{uri}
reverse_proxy bar.purplepuppy.com
}