From c4bb771f6b324100984b75b4d82c61853b1ba6a6 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sun, 21 Jul 2019 00:27:29 +0300 Subject: [PATCH] add automatic public domain/address with tls section under Host, although it's a configurator --- Automatic-public-address.md | 40 +++++++++++++++++++++++++++++++++++++ Home.md | 1 + _Sidebar.md | 1 + 3 files changed, 42 insertions(+) create mode 100644 Automatic-public-address.md diff --git a/Automatic-public-address.md b/Automatic-public-address.md new file mode 100644 index 0000000..e0d030c --- /dev/null +++ b/Automatic-public-address.md @@ -0,0 +1,40 @@ +# Automatic Public Address with TLS + +Wouldn't be great to test your web application server in a more "real-world environment" like a public, remote, address instead of localhost? + +There are plenty of third-party tools offering such a feature, but in my opinion, the [ngrok](https://github.com/inconshreveable/ngrok) one is the best among them. It's popular and tested for years, like Iris. + +Iris offers ngrok integration. This feature is simple yet very powerful. It really helps when you want to quickly show your development progress to your colleagues or the project leader at a remote conference. + +Follow the steps below to, temporarily, convert your local Iris web server to a public one. + +1. Go head and [download ngrok](https://ngrok.io), add it to your $PATH environment variable, +2. Simply pass the `WithTunneling` configurator in your `app.Run`, +3. You are ready to [GO](https://www.facebook.com/iris.framework/photos/a.2420499271295384/3261189020559734/?type=3&theater)! + +[![tunneling_screenshot](https://user-images.githubusercontent.com/22900943/61413905-50596300-a8f5-11e9-8be0-7e806846d52f.png)](https://www.facebook.com/iris.framework/photos/a.2420499271295384/3261189020559734/?type=3&theater) + +- `ctx.Application().ConfigurationReadOnly().GetVHost()` returns the public domain value. Rarely useful but it's there for you. Most of the times you use relative url paths instead of absolute(or you should to). +- It doesn't matter if ngrok is already running or not, Iris framework is smart enough to use ngrok's [web API](https://ngrok.com/docs) to create a tunnel. + +Full `Tunneling` configuration: + +```go +app.Run(iris.Addr(":8080"), iris.WithConfiguration( + iris.Configuration{ + Tunneling: iris.TunnelingConfiguration{ + AuthToken: "my-ngrok-auth-client-token", + Bin: "/bin/path/for/ngrok", + Region: "eu", + WebInterface: "127.0.0.1:4040", + Tunnels: []iris.Tunnel{ + { + Name: "MyApp", + Addr: ":8080", + }, + }, + }, +})) +``` + +Read more about [[Configuration]]. diff --git a/Home.md b/Home.md index 1285915..ab79c2d 100644 --- a/Home.md +++ b/Home.md @@ -9,6 +9,7 @@ This wiki is the main source of documentation for **developers** working with (o * [[Installing Iris|Installation]] * [[Getting Started]] * [[Host]] + * [[Automatic Public Domain with TLS|Automatic-public-address]] * [[Configuration]] * [[Routing]] * [[Path Parameter Types|Routing-path-parameter-types]] diff --git a/_Sidebar.md b/_Sidebar.md index fe8d472..c1e9c79 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -4,6 +4,7 @@ * [[Installing Iris|Installation]] * [[Getting Started]] * [[Host]] + * [[Automatic Public Domain with TLS|Automatic-public-address]] * [[Configuration]] * [[Routing]] * [[Path Parameter Types|Routing-path-parameter-types]]