Skip to content

Instantly share code, notes, and snippets.

@ritec
Forked from argami/Caddyfile
Created May 17, 2023 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ritec/7bca05e82864adcd23ea2f3898772548 to your computer and use it in GitHub Desktop.
Save ritec/7bca05e82864adcd23ea2f3898772548 to your computer and use it in GitHub Desktop.
Execute HTTPS Local development in 1 Step

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