Livereload rollup7/9/2023 get the certificate and key location from env vars □Ĭonst tlsCert = process.env ? _CERT : ""Ĭonst tlsKey = process. Import fs from "fs" // □ import the 'fs' moduleĬonst production = !_WATCH Import svelte from 'rollup-plugin-svelte' TLS_CERT=./dev/certs/.pem, the certificateĪnd the can be updated to enable SSL for the livereload server: //.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 thgh / rollup-plugin-livereload Public Notifications Fork 41 Star 146 Code Issues 10 Pull requests 6 Discussions Actions Projects Security Insights 10 Open 33 Closed Projects Sort live reload 2.0.5 not working with Electron 21.2.2 and Svelte 3.49.In my case, running Windows, it's just a choco install mkcert ![]()
0 Comments
Leave a Reply. |