sudo snap install caddy --edge
Create a Caddyfile with the following content:
:3000 {
reverse_proxy localhost:3001
log {
output stdout
format json
}
}
This would serve as a proxy for a NodeJS application running on port 3001. The port caddy will be running on would be 3000.
For logging (JSON format), add the tiny bits:
:3000 {
reverse_proxy localhost:3001
log {
output stdout
format json
}
}
For logging (console format), do as follows:
:3000 {
reverse_proxy localhost:3001
log {
output stdout
format console
}
}
caddy run
yarn dev --port 3001