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

How can I use w/ TLS, a subdomain, and set my own port? #19

Open
markcerv opened this issue Sep 12, 2020 · 3 comments
Open

How can I use w/ TLS, a subdomain, and set my own port? #19

markcerv opened this issue Sep 12, 2020 · 3 comments

Comments

@markcerv
Copy link

Hello,

I am a pro plan user of ngrok which allows me to have "End-to-End TLS Tunnels".

When I fire up ngrok to work on a project, this is the command I run from Windows Terminal (or PowerShell, or CMD)

ngrok tls -subdomain=mysubdomainname 8000

I don't see how I can call ngrok using your extension and pass along those settings.
Is it possible?
If so, can you please let me know how?

Thank you.

@philnash
Copy link
Owner

Hey @markcerv,

Good question, I normally use ngrok to open http tunnels, so that's what I mainly built this to do by default.

What I would recommend is creating a named tunnel in your ngrok config that you can open with the plugin. You can define tunnels in your ngrok config as described in the documentation here.

With the latest version of this extension, you can open your ngrok config file for editing from the command palette (ngrok: edit ngrok settings) and then, when you have named tunnels in your config, when you run ngrok: start from the command palette you will see the option to start one of your named tunnels. This will use the settings from the config file.

I will consider adding commands to start a tls or tcp tunnel in addition to http tunnels, but for more complex tunnels, with subdomains, host headers and the like, I recommend creating named tunnels in your config.

Let me know if that helps!

@markcerv
Copy link
Author

@philnash

Thank you for your reply. From your hints/notes above, I was able to add to my ngrok configuration file so that it looked like:

Inside Windows 10

authtoken: 12345secret12345secret
tunnels:
   somename:
        proto: tls
        addr: 8000
        subdomain: mysubdomainname 

Then from the windows terminal, I was able to run: ngrok start somename and that named configuration worked!

Inside Visual Studio Code

Lastly, from inside of Visual Studio Code, I chose View -> Command Palette , then typed in: ngrok: edit ngrok settings and modified the ngrok.yml that it opened.

To run that tunnel, I chose View -> Command Palette, then type in ngrok: start and the named tunnel(s) that I had configured showed up, and I retyped in the name and pressed enter.

NOTES

The config file that appears when you run ngrok: edit ngrok settings could very well be a totally different ngrok.yml than the one you have configured in your main OS.

The config file that I edited from Visual Studio Code is inside of a Ubuntu WSL 2 instance that I run inside of Windows 10.
Which is NOT the same config file that I run from Windows 10 terminal/command line.

Hopefully the above notes will help others!
mark

@philnash
Copy link
Owner

philnash commented Sep 13, 2020

Thanks for following up with this @markcerv. I use a Mac, so I'm not used to VS Code in WSL 2 on Windows!

If it helps, you can set the path to the config file that ngrok for VSCode uses in the VS Code settings. I've never used WSL 2, so I don't know if this would work, but you may be able to point to the same yaml config file as the Windows 10 environment here.

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

No branches or pull requests

2 participants