Software Engineering :: Web :: Development :: HTTP :: Server :: Caddy :: Configuration :: Caddyfile :: Example :: Reverse proxy
⪼ Made with 💜 by Polyglot.
example.com {
reverse_proxy localhost:5000
}
This uses a request matcher to match only requests that start with
/api/and proxy them to the backend. All other requests will be served from the site root with the static file server. This also depends on the fact thatreverse_proxyis higher on the directive order than file_server.
example.com {
root * /var/www
reverse_proxy /api/* localhost:5000
file_server
}