Local HTTPS Development Tools Compared: mkcert, Caddy, and Reverse Proxies
httpslocal-developmentmkcertcaddycertificatesweb-development

Local HTTPS Development Tools Compared: mkcert, Caddy, and Reverse Proxies

DDev Tools Cloud Editorial Team
2026-11-17
6 min read

Compare mkcert, Caddy, and reverse proxies for trusted local HTTPS, with setup steps and troubleshooting guidance for real development scenarios.

Local HTTPS is easier to maintain when you choose the right tool for the job. This guide compares mkcert, Caddy, and HTTPS reverse proxies, then provides a reusable checklist for trusted certificates, custom development hostnames, mobile testing, secure cookies, service workers, and OAuth callbacks.

Overview

Running a web app at http://localhost is sufficient for many early experiments, but some browser features and integrations expect a secure context. Secure cookies, service workers, Web Crypto APIs, OAuth redirect flows, and integrations that validate callback URLs can expose problems that do not appear over plain HTTP. Local HTTPS also gives developers a closer approximation of a production deployment.

There are three common approaches:

  • mkcert: creates locally trusted development certificates by installing a local certificate authority on your machine. It is a good fit when your application server already supports HTTPS and you want the smallest possible setup.
  • Caddy: acts as a web server or reverse proxy and can terminate HTTPS in front of an application. It is useful when you want a simple configuration file, automatic certificate handling for suitable local names, or one consistent entry point for several services.
  • A development reverse proxy: forwards requests from a friendly HTTPS hostname to a frontend dev server, API, container, or other local process. This is practical when the application itself should remain unchanged or when multiple services need one local origin.

The easiest option depends on the requirement. For one application on one machine, mkcert is often the most direct route. For routing and HTTPS termination across several services, Caddy or another reverse proxy is usually more flexible. For testing on a phone or tablet, plan certificate trust and hostname resolution for the device rather than treating desktop localhost as sufficient.

RequirementmkcertCaddyReverse proxy
Certificate trust on one development machineStrong fit after local CA setupCan use local certificates or its own workflowDepends on the proxy and certificate setup
Wildcard development domainsCan issue certificates for selected namesUseful when routing several hostnamesSupported if the proxy and certificate cover them
HTTPS terminationUsually handled by the applicationCore use caseCore use case
Automatic renewalNot its primary purposeUseful for managed certificate workflowsVaries by implementation
Mobile-device testingRequires trust and hostname setup on the deviceConvenient as the shared HTTPS entry pointUseful when bound to a reachable local interface
Framework integrationWorks when the dev server accepts certificate filesUsually framework-agnosticUsually framework-agnostic
Team setupEach developer manages local trustCan standardize routing, but trust still needs documentationCan standardize routing and certificates

Checklist by scenario

Scenario 1: One frontend or API on your workstation

  1. Choose a development hostname, such as app.test or another reserved, non-production name used only for local work.
  2. Map the hostname to your local machine in the hosts file, for example 127.0.0.1 app.test. Avoid using a real production hostname.
  3. Install mkcert and create the local certificate authority with its trust-install command.
  4. Generate a certificate for the exact hostname, and include any additional names you will actually test, such as localhost or a local network hostname.
  5. Configure the application or frontend development server with the certificate and private key paths. Keep the key outside source control.
  6. Open the HTTPS URL and confirm that the browser displays a trusted connection before testing application features.

Use this path when the framework already exposes HTTPS configuration and you do not need routing between several local services.

Scenario 2: Several services behind one local origin

Use Caddy or another reverse proxy when the browser should see one stable origin while requests are routed to different processes. A conceptual Caddy configuration might look like this:

app.test {
    tls /path/to/app.test.pem /path/to/app.test-key.pem
    reverse_proxy /api/* localhost:4000
    reverse_proxy localhost:3000
}

The exact syntax and certificate strategy should match the installed tool and operating system. The important design is that the proxy owns HTTPS while the frontend and API can continue listening on their ordinary local ports. This also makes it easier to reproduce cookie domains, callback URLs, and path-based routing.

Scenario 3: Testing from a phone or tablet

  • Make the development machine reachable from the device on the same network, using a local network address or a name resolvable by the device.
  • Create a certificate that contains the hostname the device will visit. A certificate for desktop-only localhost is not automatically valid for another device.
  • Install and trust the local CA or certificate on the test device according to its operating system. Treat this as a test-device configuration, not a production trust model.
  • Bind the proxy or development server to an appropriate local interface, while limiting network exposure to the testing environment.
  • Test secure cookies, redirects, mixed-content warnings, and API calls from the device itself.

What to double-check

Hostname coverage: The URL in the browser must match a name listed in the certificate. Switching from app.test to an IP address can produce a name mismatch even when the certificate is otherwise valid.

Certificate and key pairing: If the server reports a TLS startup error, verify that the private key belongs to the certificate and that the process can read both files. File permissions and path quoting can differ across operating systems.

Trust stores: Trust is established per environment. A certificate trusted by your operating system may still be rejected by a browser, container, command-line client, emulator, or mobile device with its own trust behavior.

Mixed content: An HTTPS page may still fail when it requests scripts, images, fonts, or API resources over HTTP. Inspect browser developer tools and update internal URLs to use the same secure origin or an explicitly permitted development route.

Port and proxy routing: Confirm which process owns the HTTPS port, which ports the upstream services use, and whether a path such as /api is being preserved or rewritten. A successful TLS handshake does not prove that the request reaches the intended service.

Secret handling: Local private keys are sensitive even though they are for development. Do not commit them, place them in shared archives, or reuse them for staging or production. Add certificate filenames and local configuration directories to the appropriate ignore rules.

Common mistakes

  • Using a real domain name locally: This can cause confusing DNS behavior and makes it easier to send development credentials to the wrong destination. Use a clearly local hostname.
  • Trusting only the server certificate: The server presenting a certificate does not make clients trust it. Install the relevant local CA or certificate in every client that needs access.
  • Generating a certificate for the wrong name: Certificates are checked against the requested hostname, not merely against the machine or IP address.
  • Mixing proxy and application TLS without a plan: Decide where HTTPS terminates. Double termination can work, but it adds configuration and troubleshooting points. If the proxy terminates TLS, use a deliberate upstream protocol and document it.
  • Assuming localhost behaves like production: Local certificate trust does not validate production certificate automation, DNS, ingress rules, or deployment configuration. Use local HTTPS to test browser behavior, not as a substitute for deployment checks.
  • Ignoring stale certificates: After changing hostnames or renewing files, restart the relevant process and inspect the certificate actually being served. Browsers and proxies may retain connections or cached state.

When to revisit

Review this setup when a project adds secure cookies, service workers, OAuth callbacks, payment or identity integrations, a mobile client, or a second local service. Revisit it when changing frontend frameworks, container networking, operating systems, browser tooling, or proxy versions. Tool defaults, certificate installation steps, and browser trust behavior can change, so verify commands against the current documentation before onboarding a new team member.

Before acting, run this short checklist:

  1. Which hostname will the browser and test devices use?
  2. Where will HTTPS terminate: the application, Caddy, or another proxy?
  3. Which clients need to trust the local certificate?
  4. Are certificate files and private keys excluded from source control?
  5. Can the HTTPS origin reach every required upstream service?
  6. Have you tested redirects, cookies, service workers, API calls, and mobile access?

Choose mkcert for a focused single-machine setup, Caddy for a simple HTTPS-aware routing layer, and a reverse proxy when consistent local origins and multi-service routing matter most. Document the chosen hostname, trust steps, ports, and reset procedure so the workflow remains recoverable when certificates expire or the project changes.

Related Topics

#https#local-development#mkcert#caddy#certificates#web-development
D

Dev Tools Cloud Editorial Team

Technical Editor

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.