Skip to content

Instantly share code, notes, and snippets.

@dcluna
Forked from argami/Caddyfile
Created May 4, 2023 22:52
Show Gist options
  • Save dcluna/b7b47ec9b9fc18606cfbad82cd66c86c to your computer and use it in GitHub Desktop.
Save dcluna/b7b47ec9b9fc18606cfbad82cd66c86c to your computer and use it in GitHub Desktop.
Execute HTTPS Local development in 2 Steps

Execute HTTPS proxy To Rails Apps in 2 Steps 1 step

Requirements

To make a domain point to localhost we can use

  • hosts file (in mac iHost can be used for this)
  • dnsmasq

For this you only need 2 steps 1 step

Only step

  caddy reverse-proxy --from anysubdomain.lvh.me --to :3000 --internal-certs

First time will ask the pawssword to trust the cert.

After that go fake domain anysubdomain.lvh.me and will be done!! Try also with several ones!!

Video

OneStep


NOTE

If you want to use it as service you can use the Caddyfile with your normal service manager. But if you only download the binary you can do

  caddy start --config Caddyfile

The 2 step version is still valid

First step:

This step is only needed once. Unless you dont remove the trusted CA Cert you will not have to do it again anymore.

Trusting the CA Cert:

sudo bash -c "caddy start && caddy trust && caddy stop"

Second step

  caddy reverse-proxy --from anysubdomain.lvh.me --to :3000 --internal-certs
https:// {
log
tls internal {
on_demand
}
reverse_proxy :3000
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment