Skip to content

Instantly share code, notes, and snippets.

@argami
Last active February 18, 2024 21:23
Show Gist options
  • Save argami/f4ebf6025ea15460e2f7a68bccd12aca to your computer and use it in GitHub Desktop.
Save argami/f4ebf6025ea15460e2f7a68bccd12aca 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
}
@argami
Copy link
Author

argami commented May 4, 2023

So i was already happy with my 2 steps command and i just realise that in the new version it became only one!

When i executed this:

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

Already asked me to trust my cert this is related with the option --internal-certs. That was the only thing needed.

/cc @peterc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment