-
explain what you are trying to do,
Points
Subdomain.example.com/subdir to VMIPADDRESS -
show what you have already tried,
Subdomain.example.com/subdir {
proxy /subdir VMIPADDRESS {
transparent
}
}
Thankyou
explain what you are trying to do,
Points
Subdomain.example.com/subdir to VMIPADDRESS
show what you have already tried,
Subdomain.example.com/subdir {
proxy /subdir VMIPADDRESS {
transparent
}
}
Thankyou
Hi @radenmas,
That configuration you tried appears to be valid.
As long as your VM is listening at http://VMIPADDRESS:80
, it will respond to Caddy’s proxy and that response will be carried to the client.
Let us know if you’re encountering any specific issues with that setup.
The weird thing is that it doesn’t work. Gives error 404.
But anyway I got it working by copy paste edit a bunch of codes I found searching around this forum.
Unfortunately now electricity is dead so I can’t share the config
Oh, I’ve got a feeling I know what it was! Missed it the first time around.
Your site label is subdomain.example.com/subdir
, but you were proxing from the base URL /subdir
, which means that accessing your site would have been giving out those 404s unless you browsed to subdomain.example.com/subdir/subdir
.
Using proxy / VMIPADDRESS
would’ve been the correct way to go - or alternately, using subdomain.example.com
(without the /subdir
) for your site label.
this is the setting that works
rewrite {
if {path} not /
if {path} not_starts_with /subdir
to /subdir{uri}
}
proxy /subdir 192.168.31.181:81 {
websocket
without /subdir
transparent
insecure_skip_verify
except /index.html /robots.txt
}
}
the result is kinda weird, but subdomain.example.com/subdir does point to VM while subdomain.example.com to main index on caddy server
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.