<p>Im using nginx as a reverse proxy to serve an Express.js backend and a Vue.js frontend. The whole application runs in two Docker Compose images, one for development, and one for production. I'd like to be able to test the production image locally with <strong>HTTPS</strong> (especially because Vue's PWA framework depends on HTTPS to properly register service workers).</p>
<p>The issue is that to configure a let's encrypt certificate with certbot, I need to be running on a server associated with my domain through DNS. What is the correct way to set up a CI/CD workflow where I can test HTTPS locally and also push it to my production server? Do I have to buy a certificate from a different CA and update it manually?</p>
<p>I tried using certbot, but it will not work since I am not on the server that is associated with mine through DNS.</p>

<p>If the servers are independent - You don't want to expose your production systems private key on a development machine - , you want different certificates and the question becomes &quot;How do you use TLS on your development / testing infrastructure&quot;. This is a widely discussed question. E.g.:</p>
<p><a href="https://web.dev/how-to-use-local-https/" rel="nofollow noreferrer">https://web.dev/how-to-use-local-https/</a></p>
<p><a href="https://security.stackexchange.com/questions/121163/how-do-i-run-proper-https-on-an-internal-network">https://security.stackexchange.com/questions/121163/how-do-i-run-proper-https-on-an-internal-network</a></p>
<p>If your Testing Infrastructure is accessible from the Internet for a Verification Method, you can setup certbot similar to a production machine, but you'd have to aquire a domain/subdomain for this.</p>
<p>Since the reverse-proxys config and certificates are likely not part of your software, you can treat it as infrastructure for your tests and just leave them in between tests. Treating infrastructure concerns independently of your application improves modularity and therefore maintainability.</p>
