Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ngrok): Adding ngrok feature #769

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bruno-blackbird
Copy link

@bruno-blackbird bruno-blackbird commented May 28, 2024

Hello,

There is a working implementation of ngrok with caddy as a reverse proxy to automatically map urls from :

https://domain1.test to https://497b85f07962.ngrok.app
https://domain2.test to https://5fc752cab8e5.ngrok.app

It avoids having to change any url configuration in your local environement, the only limitation I found from now is that it does not work with obfuscated urls.

I also created a pull request on wardenenv/images and wardenenv/docs

@navarr
Copy link
Member

navarr commented Jun 13, 2024

Great first pass! I'm working on some modifications in branch feature/warden-769-ngrok. The most important of those is that I would like to enable NGROK_AUTHTOKEN being read from the home directory ~/.warden/.env. These tokens are likely unique per developer as opposed to per-project, so unlike most warden configuration one would not want them in vcs.

@bruno-blackbird
Copy link
Author

Great :)
I understand the point, but I already get the case where it was versioned for a project using. But it is clearly not the most common use case.
We had a premium account with a dedicated domain name. It was useful as we were working with a Global-e deported checkout integration that needed a dedicated url for the environment configuration.
We were launching ngrok depending on who needed to work with the integration. It can also be the case for some payment methods, where you cannot easily modifiy the external url.

NGROK_AUTHTOKEN: ${NGROK_AUTHTOKEN}
volumes:
- ${WARDEN_ENV_PATH:-.}/.warden/ngrok.yml:/etc/ngrok.yml:ro,cached
command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bruno-blackbird Reviewing the entrypoint script in the ngrok image, I think all you'd need to do here is just specify the NGROK_CONFIG environment variable to be /etc/ngrok.yml. The entrypoint script will start listening on all tunnels in the config file by default.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bap14 you mean instead of passing the command, yes, maybe it will be cleaner if I add it this way

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bruno-blackbird Yes, that's correct.

@bap14
Copy link
Member

bap14 commented Aug 16, 2024

I tried to manually do this locally, and I'm wondering about the caddy config. It seems it's only adjusting "get" requests. What about POST? Will it work to add an item to the cart? Or log in? Or sign up? I'm not super familiar with Caddy and its syntax, so I'm just asking.

@bruno-blackbird
Copy link
Author

@bap14 Yes it does replace only in @get, which is enough for me, I never get any need to replace urls in POST requests as adding item to the cart, log in and sign up are working fine.

The only issue I get is with website with obfuscation on urls, as they are base 64 encoded, maybe I should add base_64 version of urls in caddy config too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

3 participants