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.

Revisions

  1. argami revised this gist May 6, 2023. No changes.
  2. argami renamed this gist May 4, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. argami revised this gist May 4, 2023. 2 changed files with 4 additions and 0 deletions.
    File renamed without changes.
    4 changes: 4 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,7 @@ To make a domain point to localhost we can use
    - dnsmasq



    ### For this you only need ~~2 steps~~ 1 step

    #### Only step
    @@ -20,6 +21,9 @@ 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](https://img.youtube.com/vi/ff1JDa41tpc/0.jpg)](https://www.youtube.com/watch?v=ff1JDa41tpc)

    ---

  4. argami revised this gist May 4, 2023. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -9,9 +9,6 @@ To make a domain point to localhost we can use
    - dnsmasq



    ## Deprecated:

    ### For this you only need ~~2 steps~~ 1 step

    #### Only step
  5. argami revised this gist May 4, 2023. 1 changed file with 26 additions and 15 deletions.
    41 changes: 26 additions & 15 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Execute HTTPS proxy To Rails Apps in 2 Steps
    # Execute HTTPS proxy To Rails Apps in ~~2 Steps~~ 1 step

    ### Requirements
    - [Install caddy](https://caddyserver.com/docs/install#install) the easiest way to [download the binary](https://caddyserver.com/docs/install#static-binaries)
    @@ -8,37 +8,48 @@ 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

    #### First step

    ## Deprecated:

    ### For this you only need ~~2 steps~~ 1 step

    #### Only step

    ```shell
    caddy reverse-proxy --from anysubdomain.lvh.me --to :3000 --internal-certs
    ```
    First time will ask the pawssword to trust the cert.

    > lvh.me is a service that always returns 127.0.0.1 as the dns configuration domain and subdomain
    After that go fake domain `anysubdomain.lvh.me` and will be done!! Try also with several ones!!

    When you execute this step and go to https://anysubdomain.lvh.me you will receive a
    ![image](https://user-images.githubusercontent.com/230512/235200147-3692e0b9-263d-42f1-9cd0-94997c116599.png)

    To avoid this we need:
    ---

    #### Second step:
    # 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

    ```shell
    sudo bash -c "caddy start && caddy trust && caddy stop"
    caddy start --config Caddyfile
    ```
    ---

    After this reload the browser and will be done!!!
    # The 2 step version is still valid

    ---
    #### First step:

    # NOTE
    > This step is only needed once. Unless you dont remove the trusted CA Cert you will not have to do it again anymore.
    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
    Trusting the CA Cert:

    ```shell
    caddy start --config Caddyfile
    sudo bash -c "caddy start && caddy trust && caddy stop"
    ```

    #### Second step

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

    This will load caddy in bg and can be stopped with caddy stop.
  6. argami revised this gist May 4, 2023. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ To make a domain point to localhost we can use
    #### First step

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

    > lvh.me is a service that always returns 127.0.0.1 as the dns configuration domain and subdomain
    @@ -26,7 +26,7 @@ To avoid this we need:
    #### Second step:

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

    After this reload the browser and will be done!!!
    @@ -38,7 +38,7 @@ After this reload the browser and will be done!!!
    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

    ```shell
    caddy start -config Caddyfile
    caddy start --config Caddyfile
    ```

    This will load caddy in bg and can be stopped with caddy stop.
  7. argami revised this gist Apr 29, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # Execute HTTPS proxy To Rails Apps in 2 Steps

    ### Requirements
    - Install caddy
    - [Install caddy](https://caddyserver.com/docs/install#install) the easiest way to [download the binary](https://caddyserver.com/docs/install#static-binaries)
    - Have a domain/subdomain that points to 127.0.0.1/0.0.0.0/localhost etc.

    To make a domain point to localhost we can use
  8. argami revised this gist Apr 28, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Caddyfile
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,4 @@ https:// {
    on_demand
    }
    reverse_proxy :3000
    }
    }
  9. argami revised this gist Apr 28, 2023. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -29,4 +29,16 @@ To avoid this we need:
    sudo caddy trust
    ```

    After this reload the browser and will be done!!!
    After this reload the browser and will be done!!!

    ---

    # 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

    ```shell
    caddy start -config Caddyfile
    ```

    This will load caddy in bg and can be stopped with caddy stop.
  10. argami revised this gist Apr 28, 2023. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions Caddyfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    https:// {
    log
    tls internal {
    on_demand
    }
    reverse_proxy :3000
    }
  11. argami created this gist Apr 28, 2023.
    32 changes: 32 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    # Execute HTTPS proxy To Rails Apps in 2 Steps

    ### Requirements
    - Install caddy
    - Have a domain/subdomain that points to 127.0.0.1/0.0.0.0/localhost etc.

    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

    #### First step

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

    > lvh.me is a service that always returns 127.0.0.1 as the dns configuration domain and subdomain
    When you execute this step and go to https://anysubdomain.lvh.me you will receive a
    ![image](https://user-images.githubusercontent.com/230512/235200147-3692e0b9-263d-42f1-9cd0-94997c116599.png)

    To avoid this we need:

    #### Second step:

    ```shell
    sudo caddy trust
    ```

    After this reload the browser and will be done!!!