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

Automatic Public Domain for development #1305

Closed
kataras opened this issue Jul 17, 2019 · 0 comments
Closed

Automatic Public Domain for development #1305

kataras opened this issue Jul 17, 2019 · 0 comments

Comments

@kataras
Copy link
Owner

kataras commented Jul 17, 2019

Wouldn't be great to test your application 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 one is the best among them. It's popular and tested for years, like Iris, in fact, it has 700 stars more than Iris itself! Great job @inconshreveable!

Iris has a ngrok migration feature. Follow the steps below to make your local Iris web server a public one.

  1. Go head and download ngrok, add it to your $PATH environment variable,
  2. Simply pass the iris.WithTunneling configurator in your app.Run,
  3. You are ready to GO!

tunneling_screenshot

  • It doesn't matter if ngrok is already running or not, Iris framework is smart enough to use ngrok's web API to create a tunnel.

Full Tunneling configuration

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",
				},
			},
		},
}))
  • 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).

v11.2.0 PR: #1175

@kataras kataras added this to the v11.2.0 milestone Jul 17, 2019
@kataras kataras self-assigned this Jul 17, 2019
@kataras kataras closed this as completed Jul 23, 2019
github-actions bot pushed a commit to goproxies/github.aaakk.us.kg-kataras-iris that referenced this issue Jul 27, 2020
Former-commit-id: 54844edae9e5eed9bd6b17a06ec8d868923d3681
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant