Reverse Proxy doesn't works

There’s two problems here.

First, try_files has a higher directive order than reverse_proxy, so it always runs first and rewrites the request because the file doesn’t exist on disk.

Second, your matcher is /soc/*, which doesn’t match /soc.

You should use handle to make it mutually exclusive:

:80 {
	handle /soc* {
		reverse_proxy 127.0.0.1:5000
	}

	handle {
		root * /home/paulo/projecto_html
		try_files {path} /index.html
		file_server browse
	}
}

If you plan on running your server long-term, don’t run caddy run directly, run Caddy as a service (and move your files to /srv since the service won’t have access to /home):

1 Like