Caddy Reverse Proxy NestJS/NodeJS
Using NestJS. It is easy to build a server-side application. But it's a bit troublesome to deploy. Because the files packaged by NestJS. There is no index.php/index.html file like in PHP projects or static HTML projects
To run NestJS applications behind Caddy, you need to ensure that the NestJS application is listening on a port, and then configure Caddy as a reverse proxy. Here is a basic Caddy configuration example that proxies traffic to NestJS applications running on port 3000:
Firstly, make sure that your NestJS application is listening on a port, such as 3000.
Add reverse proxy configuration in site Caddy VHost configuration file
http://www.nesttest.com {
...
reverse_proxy localhost:3000
...
}
https://www.nesttest.com {
...
reverse_proxy localhost:3000
...
}


- Restart Caddy or reload Caddy configuration
Now, when you access your server through a website domain, all requests will be forwarded by Caddy to the NestJS application running on port 3000.