Hey folks,
I’m looking at using Caddy V2 for a project. A requirement that I have to dynamic reverse proxy to another domain path, for example:
userdomain.com -> myproject.com/userdomain.com
where I don’t necessarily know what the userdomain.com will be. I’d like the reverse proxy to automatically route any domain pointed at the caddy service in the same way.
Is this possible? If so can I get some explanation how?
(Apologies if I got some terminology incorrect, I’m fairly new to this area and Caddy)
UPDATE:
Thanks to @matt’s reply below, I wrote out a solution that looks like:
{
"apps": {
"http": {
"servers": {
"example": {
"listen": ["127.0.0.1:5000"],
"routes": [
{
"handle": [
{
"handler": "rewrite",
"method": "GET",
"uri": "/{http.request.hostport}",
"rehandle": true
},
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "localhost:4444"
}
]
}
]
}
],
"automatic_https":{
"disable": true
}
}
}
}
}
}