![]() TLS_KEY=./dev/certs/, the certificate key.HOST=0.0.0.0, Caddy will need to reach Rollup's web server so we should be sure that it binds to the correct network interface.The dev server requires 3 environment variables: We can either run the dev server in Docker, or run it locally on the host machine and direct Caddy to the host's IP address. dev/certs is where the mkcert certificate is locatedĪssuming both api and webui have been setup to work in docker-compose, a docker-compose up webui should already setup the reverse proxy, the API, and the web UI. ![]() dev/Caddyfile is where the config file is located Reverse_proxy /v1/* # forward all other requests to webui:5000īy default Caddy already handle forwarding between HTTP to HTTPS, so we have something else to do here.Īnd to run it, the following docker-compose.yml does the trick: version: "3.8" ![]() # forward requests from which the path starts with /v1 to whatever is listening on api:5001 The configuration is done with a Caddyfile, that would look something like this: # specify the domain you want to use for your local development That way we can also share the same port for both, which simplifies the whole process as we won't face CORS issues.Ĭaddy is the simplest web server and reverse proxy to setup that I've ever faced. The frontend or backend projects are unlikely to handle the SSL protocol themselves, instead the common approach is to run them behind a reverse proxy. And that's it, just rename the key and certificate to something that makes sense.Create a new certificate for the project: mkcert localhost.Generate and install the CA (Certificate Authority): mkcert -install.In my case, running Windows, it's just a choco install mkcert Install mkcert, as documented in the readme.Mkcert is a command line tool that makes it ridiculously simple to generate locally trusted certificates, for development. Fortunately, using Docker that can be done done easily in just a few steps. But even without cookies it's a good idea to try to minimize differences between your development and production environments. For example if your project works with cookies, it is likely that the server sets the Secure attribute, ensuring that they only sent to the server over HTTPS. When working on web projects it is often useful and recommended to enable SSL for your development environment.
0 Comments
Leave a Reply. |