How to point subdir to VM?


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 :frowning:

Oh, I’ve got a feeling I know what it was! Missed it the first time around.

Your site label is, 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

Using proxy / VMIPADDRESS would’ve been the correct way to go - or alternately, using (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 {
without /subdir
except /index.html /robots.txt

the result is kinda weird, but does point to VM while to main index on caddy server

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.